Max

Returns the highest valid value in a field.

Format 

Max ( field {; field...} )

Parameters 

field - any related field, repeating field, or set of non-repeating fields; or an expression that returns a field, repeating field, or set of non-repeating fields.

Parameters in braces { } are optional.

Data type returned 

text, number, date, time, timestamp

Originated in version 

6.0 or earlier

Description 

Field can be any of the following:

  • a repeating field (repeatingField).
  • a field in matching related records specified by (table::field), whether or not these records appear in a portal.
  • several non-repeating fields in a record (field1;field2;field3...).
  • corresponding repetitions of repeating fields in a record (repeatingField1;repeatingField2;repeatingField3), if the result is returned in a repeating field with at least the same number of repeats.
  • several fields in the first matching record specified by (table::field1;table::field2;...). You can include fields from different tables (table 1::field A;table 2::field B...).

Notes 

  • When a referenced field is a repeating field, the Max function returns the maximum value in the first repetition field, then the maximum value in the second repetition field, and so on.
  • If the parameters are of different data types, the Min and Max functions convert all parameters to numbers before comparing them. If all parameters are text, these functions compare the parameters as text.

Example 1 

The Accounts layout has a portal showing installment payments made.

Max(Payments::PaymentDate) returns the most recent date a payment was made on an account.

Example 2 

In the following examples:

  • Field1 contains two repetitions with values of 1 and 2.
  • Field2 contains four repetitions with values of 5, 6, 7, and 8.
  • Field3 contains 6.

Max(Field2) returns 8 when the calculation isn't a repeating field.

Max(Field1;Field2;Field3) returns 6, 6, 7, 8 when the calculation is a repeating field.