Function DbCreateExtStruct() Foundation

Creates and opens an empty structure extended file.

Syntax
DbCreateExtStruct( <cFilename> ) --> lSuccess
Parameters
<cFilename>
<cFilename> is a character string containing the name of the structure extended file to be created. When the file name does not include a file extension, the default extension predetermined by the current database engine (DBE) is used. The default file extension of the DBFDBE is ".DBF".
Return

The function DbCreateExtStruct() returns the value .T. (true) when the structure extended file <cFilename> was created. Otherwise it returns .F. (false).

Description

The database function DbCreateExtStruct() creates an empty structure extended file named <cFilename> and opens it in the current work area. A structure extended file contains records with the field definitions for another file. The fields of a structure extended file are predetermined and described in the following table:

Fields of a structure extended file
Field name Field type Field length Decimal places
FIELD_NAME Character 10 0
FIELD_TYPE Character 1 0
FIELD_LEN Numeric 5 0
FIELD_DEC Numeric 4 0

New databases can be created from the records of a structure extended file. This is done using the function DbCreateFrom(). Another way to create new databases is using the function DbCreate(). DbCreate() uses a two dimensional array for the field definition instead of a file.

Contrary to dBase or CA Clipper the length of the field FIELD_LEN is not 3 but 5. The length of a character field with more than 999 characters can be entered directly and no longer needs to be encoded using the decimal places FIELD_DEC.

Examples
DbCreateExtStruct()
// The example demonstrates how files can be created with 
// DbCreateExtStruct() and DbCreateFrom(). 

PROCEDURE Main 

   DbCreateExtStruct( "Struct.dbf" ) 
   DbAppend() 

   FIELD->FIELD_NAME := "UserID" 
   FIELD->FIELD_TYPE := "C" 
   FIELD->FIELD_LEN  :=  5 
   FIELD->FIELD_DEC  :=  0 

   DbAppend() 
   FIELD->FIELD_NAME := "UserName" 
   FIELD->FIELD_TYPE := "C" 
   FIELD->FIELD_LEN  :=  30 
   FIELD->FIELD_DEC  :=  0 

   DbCloseArea() 
   DbCreateFrom( "Login.dbf",, "Struct.dbf" ) 
   DbCloseArea() 

   FErase( "Struct.dbf" ) 
RETURN 
Feedback

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.