Click or drag to resize

DbFileSpec.Create Method (Typed)

X#
Create a new DBF file with the given name, using a provided DBStruct array.

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VORDDClasses (in XSharp.VORDDClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD Create(
	cFullPath,
	aDbStruct,
	cDriver,
	lWantAnsi,
	aRdds
) AS USUAL CLIPPER
Request Example View Source

Parameters

cFullPath (Optional)
Type: Usual
The file name for the new DBF and optional path or FileSpec object.
aDbStruct (Optional)
Type: Usual
The layout of the DBF to be created with each field represented by a subarray containing the field name, the type, the length, the decimals, and the alias in the DBStruct() format if different from SELF's DBF file structure.
cDriver (Optional)
Type: Usual
The RDD used to create the new DBF file structure if different from SELF's.
lWantAnsi (Optional)
Type: Usual
TRUE if this new DBF is to be an ANSI DBF (default).
aRdds (Optional)
Type: Usual
The 1-D array of 'hidden' RDDs required to open a DBF file, such as DBFMEMO. Defaults to SELF's.

Return Value

Type: Usual
TRUE if successful; otherwise, FALSE.
Remarks
The DBFileSpec:Create() method is useful for generating a new DBF file given a file specification and path. The DBCreate() function is also useful to do the same thing, however this approach is more efficient. Note that the DBServer class does not contain a Create() method: instantiating a DBServer requires that the file exists already, so one cannot be created. The CopyDB() and CopyStructure() methods of the DBServer class often provide an easier way of copying the structure, completely or partially, of an existing file. Note that the method does not open the file.
Examples
X#
 1aDBF := { { "FLD1_C", "C", 10, 0 }, { "FLD2_N", "N", 10, 2 }, { "FLD3_D", "D", 8, 0 }, ;
 2{ "FLD4_L", "L", 1, 0 }, { "FLD5_M", "M", 10, 0 } }
 3aRDD := { "DBFMEMO" }
 4cSomePath    := WorkDir{} + "data\"
 5SetDefault( "C:\TEST" )
 6oDB := DBFileSpec{}
 7// create a DBF/DBV file
 8oDB:Create( "NewFile1", aDBF, "DBFNTX", TRUE, aRDD )
 9// create a DBF/FPT file to a different folder
10oDB:Create( cSomePath + "NewFile2", aDBF, "DBFCDX", TRUE )
See Also