ARRAYMAX

ARRAYMAX(*values)[source]

Returns the maximum value(s) across one or more numeric inputs or arrays.

ARRAYMAX performs either a scalar maximum operation or an element-wise maximum operation depending on the input types:

  • Scalar operation: If all inputs are single values, returns the largest value.

  • Element-wise array operation: If any input is an array, performs a position-wise maximum across all inputs, broadcasting scalar values to match array lengths.

Parameters:

*values (Operand | int | float) –

One or more numeric values or arrays to compare. Each value must be one of the supported types. Mixed inputs (scalars and arrays) are allowed.

Supported types:

  • INTEGER

  • DECIMAL

  • INTEGER_ARRAY

  • DECIMAL_ARRAY

Return type:

Formula

Returns:

A formula object representing the maximum scalar if all inputs are scalar values, an array of element-wise maximums if any input is an array. The return type is DECIMAL if any decimal input is present; otherwise INTEGER. Array outputs match the length of input arrays. All arrays must have equal length else an error value is returned.

Supported types:

  • INTEGER

  • DECIMAL

  • INTEGER_ARRAY

  • DECIMAL_ARRAY

Raises:
  • ValueError – If no input is provided.

  • ValueError – If any input is not a supported numeric type.

Examples

Basic scalar usage:

ARRAYMAX(1, 5, 3)
# Returns 5

Element-wise array comparison:

ARRAYMAX(
    [1, 2, 3],
    [4, 1, 2]
)
# Returns [4, 2, 3]

Mixed scalar and array:

ARRAYMAX(
    5,
    [2, 7, 4]
)
# Returns [5, 7, 5]