| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Searches a record number in the controlling index.
OrdFindRec( <nRecno>, [<lCurrentRec>] ) --> lFound
The function returns .T. (true) if a record is found in the controlling index that has the record number <nRecno>, otherwise .F. (false) is returned.
OrdFindRec() searches a record number in the controlling index. It is similar to DbSeek(), which searches an index key. If OrdFindRec() finds the record number <nRecno> in the controlling index, it positions the record pointer on the found record, and Function Found() returns .T. (true) until the record pointer is moved again. In addition, both functions, BoF() and EoF() return .F. (false).
When a matching record number is not found, the record pointer is positioned on the "ghost record" (Lastrec()+1), and the function Found() returns .F. (false), while Eof() returns .T. (true).
| See also: | DbOrderInfo(), DbSeek(), OrdKeyGoto(), OrdKeyVal(), OrdWildSeek() |
| Category: | Database functions , Index functions , xHarbour extensions |
| Source: | rdd\dbcmd.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example navigates the record pointer via the controlling index
// using physical and logical record numbers,
REQUEST Dbfcdx
PROCEDURE Main
USE Customer VIA "DBFCDX"
INDEX ON Upper(LastName) TAG NAME TO Cust01
OrdFindRec( 1 ) // Physical first record
? Lastname, Recno(), OrdKeyNo() // result: Miller 1 15
OrdFindRec( LastRec() ) // Physical last record
? Lastname, Recno(), OrdKeyNo() // result: Smith 22 19
OrdKeyGoto( 1 ) // Logical first record
? Lastname, Recno(), OrdKeyNo() // result: Alberts 20 1
OrdKeyGoto( OrdKeyCount() ) // Logical last record
? Lastname, Recno(), OrdKeyNo() // result: Waters 15 22
OrdFindRec( -1 ) // Non-existent record
? Lastname, Recno(), OrdKeyNo() // result: 23 0
? Bof(), Eof(), Found() // result: .T. .T. .F.
USE
RETURN
http://www.xHarbour.com