Last

Returns the last valid, non-blank value in a field.

Format 

Last ( repeatingField )

Parameters 

repeatingField - any repeating field or related field, or an expression that returns a reference to a repeating field or related field

Data type returned 

text, number, date, time, timestamp, container

Originated in version 

6.0 or earlier

Description 

If repeatingField specifies a repeating field then it returns the last non-blank repetition. If repeatingField specifies a related field, then it returns the last non-blank value in the related set.

Notes 

  • The last related value will depend on the way related records are sorted. If the related records are not sorted, then the Last function returns a value based on the creation order of the records.

Example 1 

Last(ParcelBids) returns 1500 if ParcelBids is a number field defined to repeat with ten values and contains the values 2500, 1200, and 1500.

Example 2 

Last(Payments::PaymentDate) returns the payment date in the last matching record in the Payments table.

Example 3 

Last(if(IsEmpty(Company);PersonalPhone;WorkPhone)) returns the last non-empty phone number from the repeating field PersonalPhone when the Company field is empty. If the Company field is not empty, the function returns the last non-empty phone number from the repeating field WorkPhone.