Click or drag to resize

DbApp Function

X#
Import records from a database file.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION DbApp(
	cSourceFile,
	acFields,
	cbForCondition,
	cbWhileCondition,
	nNext,
	nRecord,
	lRest,
	cDriver,
	acRDDs
) AS LOGIC CLIPPER
Request Example View Source

Parameters

cSourceFile (Optional)
Type: Usual
The name of the database file from which to add records, including an optional drive, directory, and extension.
See SetDefault() and SetPath() for file searching and creation rules.
The default extension for database files is determined by the RDD .
This function attempts to open cSourceFile in shared mode.
If the file does not exist, a runtime error is raised.
If the file is successfully opened, the operation proceeds.
If access is denied because, for example, another process has exclusive use of the file, NetErr() is set to TRUE.
acFields (Optional)
Type: Usual
The list of fields to append from cSourceFile.
The default is all fields.
Only fields with the same names and types in both files are appended.
If fields with the same name do not match in data type, a runtime error is raised.
cbForCondition (Optional)
Type: Usual
A code block that defines a condition that each record within the scope must meet in order to be processed.
cbWhileCondition (Optional)
Type: Usual
A code block that defines another condition that each record must meet in order to be processed. As soon as a record is encountered that causes the condition to fail, the operation terminates.
If no scope is specified, cbWhileCondition changes the default scope to lRest.
You define the scope using one of these three, mutually exclusive arguments.
The default is all records.
nNext (Optional)
Type: Usual
The number of records to process, starting at nRecord. Specify 0 to ignore this argument.
nRecord (Optional)
Type: Usual
A single record number to process. Specify 0 to ignore this argument.
lRest (Optional)
Type: Usual
TRUE processes only records from nStart to the end of the file. FALSE processes all records.
cDriver (Optional)
Type: Usual
The name of the RDD that will service the data server. If not specified, the default RDD as determined by RDDSetDefault() is used. The name of the RDD that will service the work area.
If not specified, the default RDD as determined by RDDSetDefault() is used.
acRDDs (Optional)
Type: Usual
A one-dimensional array with the names of RDDs from which the main RDD inherits special functionality.
This allows you to use RDDs with special capabilities, like encryption or decryption, in different work areas with different database drivers.
These RDDs overlay special functions of the main RDD (specified with the cDriver argument).
If multiple RDDs (specified with this argument) implement the same function, the function associated with the last RDD in the list takes precedence.
If acRDDs is omitted, no additional RDDs are assumed.

Return Value

Type: Logic
TRUE if successful; otherwise, FALSE.
Remarks
Tip Tip
The nNext, nRecord, and lRest arguments are mutually exclusive. You should not pass all three of them. And if you pass the cbWhile argument then this also controls the scope behavior.
By default, this function adds record to the database file in the currently selected work area.
It can be made to operate on an unselected work area by specifying it within an aliased expression. DBApp() does not require that the database file be used exclusively or locked with FLock() to perform its operation.
As each record is added, X# automatically arbitrates contention for the new record. DBApp() is the functional equivalent of the APPEND FROM command, specified without a DELIMITED or SDF clause.
Examples
The following example adds records from the OLD.DBF file:
X#
1DbApp("old.dbf")
See Also