ORDKEYNO() Get the logical record number of the current record ------------------------------------------------------------------------------ Syntax ORDKEYNO([<cOrder> | <nPosition>], [<cIndexFile>]) --> nKeyNo Arguments <cOrder> | <nPosition> is the name of the order or a number representing its position in the order list. Using the order name is the preferred method since the position may be difficult to determine using multiple-order index files. If omitted or NIL, the controlling order is assumed. Specifying an invalid order will raise a runtime error. <cIndexFile> is the name of an index file, including an optional drive and directory (no extension should be specified). Use this argument with <cOrder> to remove ambiguity when there are two or more orders with the same name in different index files. If <cIndexFile> is not open by the current process, a runtime error is raised. Returns ORDKEYNO() returns the relative position of the current record in the specified order as a numeric value. ORDKEYNO() respects the scope and for condition of the order by returning zero if the record pointer is positioned on an invalid record or if EOF() is true (.T.). Description ORDKEYNO() returns the logical record number of a key in an order. This is in contrast to the physical record number (returned using the RECNO() function), which is the relative position of the record in the physical database file. Tip: This function can be useful for displaying scroll bars and messages, such as "Record 9 of 123," when viewing records in a browser. By default, this function operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression. Examples . This example shows the difference between physical and logical record number: USE Customer // Assuming 1000 records SET INDEX TO First // Make records in first order GO TOP // Position the data pointer at // the first record ? ORDKEYNO() // Result: 1 DBSKIP(10) ? ORDKEYNO() // Result: 11 ? RECNO() // Result: Physical record number DBGOBOTTOM() ? ORDKEYNO() // Result: 1000 ? RECNO() // Result: Physical record number Files Library is CLIPPER.LIB.
See Also: ORDKEYCOUNT() ORDKEYGOTO() ORDSCOPE() RECNO()