Function LastRec() Foundation

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

LastRec() --> xLastRecordID

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.


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.

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

   USE Customer  ALIAS Cust NEW 
   USE Invoice   ALIAS Inv  NEW 

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



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.