Click or drag to resize

VoDbLocate Function

X#
Search for the first record that matches a specified condition and scope.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION VoDbLocate(
	cbForCondition AS USUAL,
	cbWhileCondition AS USUAL,
	liNext AS LONG,
	uRecord AS USUAL,
	lRest AS LOGIC
) AS LOGIC
Request Example View Source

Parameters

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.
liNext
Type: Long
The number of records to process, starting with the current record.
To omit this argument, specify -1.
uRecord
Type: Usual
The number of the record to process.
To omit this argument, specify -1.
lRest
Type: Logic
TRUE processes only records from the current record to end-of-file. FALSE processes all records.

Return Value

Type: Logic
TRUE if successful; otherwise, FALSE.
Remarks
VODBLocate() is like DBLocate() but is strongly typed.
This function, however, does not call the error handler and will not, therefore, produce a runtime error message or create an error object if it fails. Thus, it may be important to check the return value to determine if the function succeeded.
The global structure, StrucErrInfo, will contain needed information regarding any error that occurs. See DBLocate() for more information.
Examples
The following example locates the first sale in the past 30 days in the city of LA:
X#
1USE sales
2VODBLocate({||City == "LA"}, {||SaleDay > ;
3    TODAY()-30},-1,NIL,FALSE)
See Also