Click or drag to resize

LastRec Function (Usual)

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

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.6
Syntax
 FUNCTION LastRec(
	uArea AS USUAL
) AS DWORD
Request Example View Source

Parameters

uArea
Type: Usual
Specifies the work area name or number for a table from which the value must be retrieved.

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, 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 that accepts a workarea parameter (a workarea number or alias ).
Examples
This example illustrates the relationship between LastRec(), RecCount(), and COUNT:
X#
1USE sales NEW
2QOut(LastRec(), RecCount())
3// Result: 84 84
4SET FILTER TO Salesman = "1001"
5COUNT TO nRecords
6QOut(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#
1USE sales NEW
2USE customer NEW
3QOut(LastRec(), Sales->LastRec())
See Also