LAST

Returns the value from the last child record for each parent record. The child records are looked at in natural unsorted order.

LAST ( <field_name> [, Index [, <filter_query>] ] )
  • field_name: The name of a field to return the value from.

  • index: The index of the record to return.

  • filter_query: A query string representing the domain of records to include.

Example: create a field on the CUSTOMER table that returns the product code of the second to last purchase that each customer bought in 1994.

LAST( [PRODUCT.PRODUCT_CODE],2,[PRODUCT.PURCHASE YEAR] = "1994")