Find last

Command group Flag affected Reversible Execute on client Platform(s)
Finding data YES YES NO All


Find last on field-name ([Use search][,Use sort])


Use search If specified, the command uses the current search to select data
Use sort If specified, the command uses the current sort field(s) to order the data


This command automatically locates and displays the last record in a file using a specified indexed field. You can use the Find last command to locate the last record added to a file by using the record sequencing number as the index. The flag is set false if no record is found.

You use the Use search option in conjunction with the specified indexed field to select the last record which fulfils the search specification. If the search is a calculation, the optimizer will choose the best index if the index field is left blank.

Whenever you use a Find command, a find table is created which determines the order in which records are displayed using subsequent Next and Previous commands. Once a find table has been created, subsequent Next or Previous commands will use the table provided the commands have an empty or the same Index, and the same (or empty) Search and Exact match conditions. A Clear find table, a new Find on the same file or Next/Previous commands with a new (non-blank) index or a Search or Exact match where the original Find had none, will clear the find table.

The Use Sort option works in conjunction with the current sort fields (see Set sort field) to create a table of entries from the data file which are sorted into an order set by up to 9 sort fields. Refer to the Find command for details of the find table and its use.


; Find the last account record in the file, but restore
; the original record when this method finishes
Begin reversible block
  Set main file {fAccounts}
  Find last on fAccounts.Code (Use search)
End reversible block