Skip to main content

Array Reduce Functions

AMPS includes a set of functions designed to operate over an array element in a message and produce a value. These functions take an array within a single message as input, and reduce that array to a single value as output.

FunctionParametersDescription
ARRAY_COUNTarrayReturns the number of elements in the array.
ARRAY_MAXarrayReturns the largest value in the array, using the standard AMPS > comparison.
ARRAY_MINarrayReturns the minimum value in the array, using the standard AMPS < comparison.
ARRAY_SUMarray

Returns a number produced by adding all of the elements in the array.

NULL values in the array are ignored.

ARRAY_TO_STRINGarray, delimiter, null_replacement

Returns a string comprised of the elements of the array, separated by the provided delimiter.

NULL values in the array are replaced with the provided null_replacement value.