Click or drag to resize

LastRec Function

Return the number of the last record in a database file.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION LastRec() AS DWORD
View Source

Return Value

Type: UInt32
The number of physical records in a database file.  Filtering or deleted settings have no effect on the return value.  LastRec() returns 0 if there is no database file in use.
Remarks
By default, LastRec() 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 (see example below).
Examples
This example illustrates the relationship between LastRec(), RecCount(), and COUNT:
X#
USE sales NEW
QOut(LastRec(), RecCount())
// Result: 84 84
SET FILTER TO Salesman = "1001"
COUNT TO nRecords
QOut(nRecords, LastRec())        // Result: 14 84
This example uses an aliased expression to access the number of records in a open database file in an unselected work area:
X#
USE sales NEW
USE customer NEW
QOut(LastRec(), Sales->LastRec())
See Also