Function LastRec() Foundation

Returns a value which clearly identifies the last record in a work area.

Syntax
LastRec() --> xLastRecordID
Return

The function LastRec() returns a value (referred to as the record ID) identifying the last record in a work area. The data type of this record ID is predetermined by the file format of the data files. For DBF files, the record ID is a numeric value designating the data record number. When no file is opened, zero is returned.

Description

The database function LastRec() determines the record ID of the last record in a work area. When the function is used without the alias operator, it returns the record ID of the last record in the current work area. For DBF files, this is the record number and is a numeric value. For another file format it might be a value for the primary key which does not have to be numeric.

Examples
LastRec()
// The examples illustrates the usage of LastRec() 
// with and without alias operator 

PROCEDURE Main 
   USE Customer  ALIAS Cust NEW 
   USE Invoice   ALIAS Inv  NEW 

   ? Alias()                 // result: INV 
   ? LastRec()               // result: 575 
   ? Cust->(LastRec())       // result: 100 

   CLOSE DATABASES 
RETURN 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.