OrdKeyNo Function | |
Get the logical record number of the current record.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION OrdKeyNo(
uOrder,
cIndexFile
) AS USUAL CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static Usual OrdKeyNo(
Usual uOrder = default,
Usual cIndexFile = default
)
Request Example
View SourceParameters
- 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.
- cIndexFile (Optional)
- Type: Usual
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.
Return Value
Type:
Usual
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.
Remarks
OrdKeyNo() returns the logical record number of a key in an order.
This 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 can be made to operate on an unselected work area by specifying
it within an aliased expression
Examples
This example shows the difference between physical and logical record number:
1USE customer
2SET INDEX TO first
3? OrdKeyNo()
4DBSkip(10)
5? OrdKeyNo()
6? RECNO()
7DBGoBottom()
8? OrdKeyNo()
9? RECNO()
See Also