Skip to content

Max

aggregating category: aggregation no `||`

Returns the largest value among the given parameters or inputs, folding ARRAY inputs element-by-element.

Without parameters, Max selects the maximum across all available inputs. When parameters are given, it chooses among those parameters only.

An ARRAY input is folded element-by-element — Max compares array contents, never an array as a whole — so scalars and arrays mix freely in one call (e.g. Max(5, :int_array)), and GetCDMTableId(@idx, :key)[] => Max() yields the maximum of all matched values. The element type drives the comparison; when every input is an ARRAY the output type defers to the destination field.

Parameters

Ncandidates Optional — accepts: field, DATE, FLOAT, INT, STRING

The Nth candidate value. May be a field reference (scalar or ARRAY) or a static value.

Input type

  • DATE
  • FLOAT
  • INT
  • STRING
  • ARRAY

Output type

  • same-as-input

Requires

  • All parameter types and (scalar) input types must be identical; ARRAY element types must match too.

Examples

Max across all inputs

Max()

Two field references

Max(:value1, :value2)

Field reference vs. static value

Max(:value, 42)

Lexicographic max of strings

Max(:text1, :text2, "Zulu")

Maximum of a collected ARRAY

GetCDMTableId(@idx, :key)[] => Max()

See also

Min, Sum, Count, Avg, Selector