Function DbCreateExtStruct() Foundation
Creates and opens an empty structure extended file.
DbCreateExtStruct( <cFilename> ) --> lSuccess
The function DbCreateExtStruct() returns the value .T. (true) when the structure extended file <cFilename> was created. Otherwise it returns .F. (false).
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:
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.
// 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
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.