Return the current record number.
XSharp.RT (in XSharp.RT.dll) Version: 2.18
Syntax Request Example
FUNCTION RecNo() AS DWORD
public static uint RecNo()
The current record number.
If the work area contains a database file with 0 records, RecNo() returns 1, BOF() and EOF() both return TRUE, and LastRec() returns 0.
If the record pointer is moved past the last record, RecNo() returns LastRec() + 1 and EOF() returns TRUE.
If an attempt is made to move before the first record, RecNo() returns the record number of the first logical record in the database file and BOF() returns TRUE.
If no database file is open, RecNo() will return a 0.
X# database files are physically ordered by record number.
Each work area in turn maintains a pointer to the current record in its open database file. That record number is reported by RecNo().
This allows direct access to a record without sequentially scanning the database file to reach the specified record position.
Typically, RecNo() generalizes routines that process records by record number.
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 or by calling the overload that accepts a workarea
parameter (a workarea number or alias ).
This example queries RecNo() after deliberately moving the record pointer:
1USE customer NEW
6nRecord := 3
This example uses aliased expressions to query the value of RecNo() in unselected work areas:
1USE sales NEW
2USE customer NEW