xHarbour Reference Documentation > Function Reference |
Returns the logical record number of the current record.
OrdKeyNo( [<nOrder>|<cIndexName>], [<cIndexFile>] ) --> nOrdKeyNo
The function returns the logical record number of the current record as a numeric value. Logical record numbers are in the range of 1 to OrdKeyCount() and depend on the controlling index. If the current record is not included in the index, the return value is zero.
OrdKeyNo() is used to determine the logical record number of the current record. The logical record number represents the position of a record in the controlling index, while the physical record number Recno() represents a record's position in the database. Physical record movement is accomplished using function DbGoTo(), while logical record pointer movement is done with OrdKeyGoTo().
See also: | DbOrderInfo(), INDEX, OrdKey(), OrdKeyCount(), OrdKeyGoTo(), OrdKeyRelPos(), OrdListAdd(), OrdNumber(), OrdScope(), Recno() |
Category: | Database functions , Index functions |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example outlines the difference between physical and logical // record numbers in an indexed database without and with scope. #include "Ord.ch" PROCEDURE Main USE Customer INDEX ON Upper(LastName+Firstname) TAG Name TO Cust01 ? LastRec() // result: 225 ? OrdKeyCount() // result: 225 GO TOP ? Recno() // result: 15 ? OrdKeyNo() // result: 1 GO BOTTOM ? Recno() // result: 123 ? OrdKeyNo() // result: 225 OrdScope( TOPSCOPE , "E" ) OrdScope( BOTTOMSCOPE, "G" ) ? LastRec() // result: 225 ? OrdKeyCount() // result: 13 GO TOP ? Recno() // result: 87 ? OrdKeyNo() // result: 1 GO BOTTOM ? Recno() // result: 207 ? OrdKeyNo() // result: 13 USE RETURN
http://www.xHarbour.com