VoDbSetLocate Function | |
Specify the code block for a locate condition.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION VoDbSetLocate(
cbForCondition AS USUAL
) AS LOGIC
public static bool VoDbSetLocate(
Usual cbForCondition
)
Request Example
View SourceParameters
- cbForCondition
- Type: Usual
A code block that defines a condition that each record within the scope must meet in order to be processed.
If no scope is specified, cbForCondition changes the default scope to all records.
The code block should contain a logical expression.
It corresponds to the first argument of DBLocate() or VODBLocate().
It is valid until it is overwritten by the next VODBSetLocate().
Return Value
Type:
Logic
TRUE if successful; otherwise, FALSE.
Remarks
VODBSetLocate() allows you to change the locate condition. Once you issue a LOCATE command, DBLocate(), or VODBLocate(), you could continue searching but with a different condition.
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
Note that this function 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.
Examples
The following example shows how to search on two different and independent criteria:
1FUNCTION Locators() AS LOGIC
2 LOCAL cbForCondition, cbWhileCondition, nNext, ;
3 uRecId, lRest
4 USE test
5 cbForCondition := {||Proper(ALLTRIM(Name)) == ;
6 "Charly"}
7 cbWhileCondition := {||TRUE}
8 nNext := -1
9 uRecId := NIL
10 lRest := FALSE
11
12 DBLocate(cbForCondition, cbWhileCondition, ;
13 nNext, uRecId, lRest)
14 ? Found(), RECNO(), Name
15
16 VODBSetLocate({||Proper(ALLTRIM(Name))=="Odile"})
17 CONTINUE
18 ? Found(), RECNO(), Name
19 DBCloseArea()
20 RETURN Found()
See Also