Click or drag to resize

DbServer.OrderKeyNo Method (Usual, FileSpec)

X#
Get the logical record number of the current record.
A numeric value representing the logical record number of the current record. The DBServer:OrderKeyNo assign sends a NotifyRecordChange message upon successful completion.

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VORDDClasses (in XSharp.VORDDClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD OrderKeyNo(
	uOrder AS USUAL,
	oFSIndex AS FileSpec
) AS LONG
Request Example View Source

Parameters

uOrder
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 value will raise a runtime error.
oFSIndex
Type: FileSpec
A string or filespec object that specifies 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 oFSIndex is not open by the current process, a runtime error is raised.

Field Value

Type: Long
A numeric value representing the logical record number of the current record. The DBServer:OrderKeyNo assign sends a NotifyRecordChange message upon successful completion.

Return Value

Type: Long
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.
Remarks
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.
Examples
This example shows the difference between physical and logical record number:
X#
1oDBCust := Customer{}    // Assuming 1000 records
2oDBCust:SetIndex("first")    // Make records in first name order
3? oDBCust:OrderKeyNo()    // Result: 1
4oDBCust:Skip(10)
5? oDBCust:OrderKeyNo()    // Result: 11
6? oDBCust:RECNO        // Result: Unknown
7oDBCust:GoBottom()
8? oDBCust:OrderKeyNo()    // Result: 1000
9? oDBCust:RECNO        // Result: Unknown
See Also