CopyStructureExtended

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

CopyStructureExtended

Declaration

function CopyStructureExtended( sFileName : String ) : WordBool;

Description

Creates a data table that holds the record structure of the currently selected file. The new structure extended file has the following format:

 

FIELD NAME TYPE LEN DEC

FIELD_NAME C 10 0

FIELD_TYPE C 1 0

FIELD_LEN N 5 0

FIELD_DEC N 3 0

 

Each record in the output file represents one field in the source data table. This function, in conjunction with CreateFrom , may be used to create empty copies of a given data table. The structure extended file may also be modified by adding, deleting, or changing items such as field length - which allows modification of the source file.

Parameters

sFileName: The name of the data table that will hold the structure of the currently selected file. Full path and extension may be included.

image\tip.gif When working with a remote table via Apollo Database Server, you may only create the structure table within the same Database directory as the source table. The remote client cannot specify a physical server drive/path location and must use the defined server alias instead.  Any physical drive/path included in the sFileName parameter will be ignored for remote tables.

Return Value

True or False depending on the outcome of the operation.

Delphi Example

The pseudo code below shows the steps required to modify an existing data table:

 

with ApTbl do 

begin 

 CopyStructureExtended( 'struc.dbf' );

 Close; 

 TableName := 'struc.dbf'; 

 Open; 

          // Modify, Delete and/or Add Field descriptors

          Pack; // If field descriptors deleted

 Close; 

 CreateFrom( 'newdbf', 'struc', SDEFOX ); 

 AppendFrom( 'source', SDEFOX, '' ); 

 DeleteFile( 'struc.dbf' ); 

end; 

image\tip.gif Field types should not be changed. If a field type is changed from character to numeric, for example, AppendFrom will not copy the contents of the old character field to the new numeric field.

See Also

AppendFrom, CopyStructure, CreateExec, CreateField, CreateFrom, CreateNew