Click or drag to resize

VoDbTrans Function

Transfer records to an open database file.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION VoDbTrans(
	wTarget AS DWORD,
	fldNames AS _FieldNames,
	cbForCondition AS USUAL,
	cbWhileCondition AS USUAL,
	nNext AS USUAL,
	nRecord AS USUAL,
	lRest AS LOGIC
) AS LOGIC
View Source

Parameters

wTarget
Type: UInt32
The work area number of the destination file.
fldNames
Type: _FieldNames
List of field names to copy
cbForCondition
Type: Usual
A code block that defines a condition that each record within the scope must meet in order to be processed.
cbWhileCondition
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
Type: Usual
The number of records to append, starting at the current record.
nRecord
Type: Usual
The number of the record to append.
lRest
Type: Boolean
TRUE processes only records from the current record to end-of-file.  FALSE processes all records.

Return Value

Type: Boolean
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.
DBTrans() copies records from one work area to another open database file. By default, this function operates on the currently selected work area.  It can be made to operate on an unselected work area by specifying it within an aliased expression
Tip Tip
Deleted source records: If SetDeleted() is FALSE, records are copied; however, the deleted records do not retain their deleted status.  No record is marked for deletion in the target file regardless of its status in the source file If SetDeleted() is TRUE, deleted records are not copied to the target database file.  Similarly, filtered records are ignored during a copy and are not included in the target file.
Examples
The following example appends the contents of file TESTFROM.DBF to TESTTO.DBF:
X#
USE testto
IF !Used()
        ? "Error opening TESTTO.DBF"
ELSE
        siTo := VODBGetSelect()
        USE testfrom NEW
        IF !Used()
                ? "Error opening TESTFROM.DBF"
        ELSE
                siFrom := VODBGetSelect()
                aStruct := DBStruct()
                DBTrans(siTo, aStruct)
                CLOSE
                DBSetSelect(siTo)
        ENDIF
        CLOSE
ENDIF
See Also