Determine if the previous search operation succeeded.
XSharp.RT (in XSharp.RT.dll) Version: 2.7
Syntax Request Example
uArea AS USUAL
) AS LOGIC
public static bool Found(
- Type: Usual
Specifies the work area name or number for a table from which the value must be retrieved.
TRUE if the last search was successful; otherwise, FALSE. Found() will also return FALSE if there is no database open in the work area.
Found() determines whether a search operation, such as DBSeek(), DBLocate(), DBContinue(), or DBSetRelation(), succeeded. When any of these commands are executed, Found() is set to TRUE if there is a match; otherwise, it is set to FALSE.
If the search command is LOCATE or CONTINUE, a match is the next record meeting the scope and condition.
If the search command is FIND, SEEK or SET RELATION, a match is the first key in the controlling order that equals the search argument.
If the key value equals the search argument, Found() is TRUE; otherwise, it is FALSE.
The value of Found() is retained until another record movement command is executed.
Unless the command is another search command, Found() is automatically set to FALSE. You can also use DBSetFound() to manually set this flag.
Each work area has a Found() value.
This means that if one work area has a relation set to a child work area, querying Found() in the child returns TRUE if there is a match.
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 or by calling the that accepts a workarea parameter (a workarea number or alias ).
This example illustrates the behavior of Found() after a record movement command:
1USE sales INDEX sales
This example tests a Found() value in an unselected work area using an aliased expression:
1USE sales INDEX sales NEW
2USE customer INDEX customer NEW
3SET RELATION TO CustNum INTO sales
This code fragment processes all CUSTOMER records with the key value "Smith" using Found() to determine when the key value changes:
1USE customer INDEX customer NEW
3DO WHILE Found()
5 . <Statements>
8 LOCATE REST WHILE Name == "Smith"