Click or drag to resize

DbServer.OrderKeyNo Method

Get the logical record number of the current record.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.7
	uOrder AS USUAL := NIL,
Request Example View Source


uOrder (Optional)
Type: Usual
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.
oFSIndex (Optional)
Type: Usual
The name of an index file, including an optional drive and directory (no extension should be specified).  Use this argument with <uOrder> to remove ambiguity when there are two or more orders with the same name in different index files. If <oFSIndex> is not open by the current process, a runtime error is raised.

Return Value

Type: Usual
The relative position of the current record in the specified order, as a numeric value.  DBServer:OrderKeyNo() respects the scope and for condition of the order by returning zero if the record pointer is positioned on an invalid record or if DBServer:EOF is TRUE.
DBServer:OrderKeyNo() returns the logical record number of a key in an order.  This in contrast to the physical record number (returned using DBServer:RecNo), which is the relative position of the record in the physical database file. DBServer:OrderKeyNo() sends a NotifyIntentToMove message before the operation. Tip:  This method can be useful for displaying scroll bars and messages such as "Record 9 of 123" when viewing records in a browser. By default, DBServer:OrderKeyNo() 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.
This example shows the difference between physical and logical record number:
1oDBCust := Customer{}    // Assuming 1000 records
2oDBCust:SetIndex("first")    // Make records in first name order
3? oDBCust:OrderKeyNo()    // Result: 1
5? oDBCust:OrderKeyNo()    // Result: 11
6? oDBCust:RECNO        // Result: Unknown
8? oDBCust:OrderKeyNo()    // Result: 1000
9? oDBCust:RECNO        // Result: Unknown
See Also