| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Checks if the last database search operation was successful
Found() --> lSuccess
The function returns .T. (true) when the last search operation in a work area was successful, otherwise .F. (false) is returned. The return value is always .F. (false), when a work area is unused.
The Found() function returns a status of a work area that indicates success of a search operation. Each work area has a Found status which is set when a search function or command is executed in a work area. The Found status is set to .T. (true) when a record matching a search condition is found. If the Found status is .T. (true), it is reset to .F. (false) when the record pointer is moved again.
This most commonly used search function is DbSeek() which searches a value in an index. This search sets the Found status explicitely. If a work area is related to a parent work area via SET RELATION, the Found status of the child work area is implicitly set to .T. (true) when a record matches the relation expression.
| See also: | DbSeek(), DbSetRelation(), Eof(), LOCATE, SEEK, SET RELATION, SET SOFTSEEK |
| Category: | Database functions , Index functions |
| Source: | rdd\dbcmd.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example illustrates return values of Found()
// in different work areas.
PROCEDURE Main
USE Invoice NEW ALIAS Inv
INDEX ON CustNo TO InvA
SET INDEX TO InvA
USE Customer ALIAS Cust
INDEX ON Upper(LastName+FirstName) TO Cust01
SET INDEX TO Cust01
? Alias() // result: CUST
DbSeek( "BECKER" )
? Found() // result: .T.
? Inv->( Found() ) // result: .F.
Inv->( DbSeek( Cust->CustNo ) )
? Inv->( Found() ) // result: .T.
? Alias() // result: CUST
DbSkip()
? Found() // result: .F.
? Inv->( Found() ) // result: .T.
CLOSE DATABASES
RETURN
http://www.xHarbour.com