DbServer.OrderKeyNo Method (Usual, String) | |
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,
cIndex AS STRING
) AS LONG
public virtual int OrderKeyNo(
Usual uOrder,
[DefaultParameterValueAttribute("", 0)] string cIndex
)
Request Example
View SourceParameters
- 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.
- cIndex
- Type: String
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 cIndex 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:
1oDBCust := Customer{}
2oDBCust:SetIndex("first")
3? oDBCust:OrderKeyNo()
4oDBCust:Skip(10)
5? oDBCust:OrderKeyNo()
6? oDBCust:RECNO
7oDBCust:GoBottom()
8? oDBCust:OrderKeyNo()
9? oDBCust:RECNO
See Also