Function DbCopyStruct() Foundation
Creates a file with the same structure as the file open in a work area.
DbCopyStruct( <cFilename>, [<aFieldNames>] ) --> lSuccess
The function DbCopyStruct() returns a logical value indicating whether the operation was successful. If this value equals .T. (true), a file could be created with the same structure as the file open in the work area.
The database function DbCopyStruct() creates the file <cFilename>using the field definitions from a work area. By specifying the array <aFieldNames>, the number of the fields in the target file can be limited.
Using DbCopyStruct(), temporary files can be created to hold a subset of data during specific processing. DbCopyStruct() is also used to create files for handling data transactions.
// In the example, a subset of a stock list file is created. The
// structure of the stock on hand file is copied into an order
// file and all records from the stock file whose count
// falls short of the minimal level are copied into the order
// file. This file is printed out and then deleted.
PROCEDURE Main
DbUseArea( .T., , "Stock" )
DbCopyStruct( "Order" )
DbUseArea(, , "Order" )
DbImport( "Stock", ;
{|| FIELD->InStock < FIELD->MinLevel } )
LIST TO PRINTER
DbCloseArea()
FErase( "Order.dbf" )
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.