Sum¶
Returns the sum of the given parameters or the available inputs, folding ARRAY inputs element-by-element.
Without parameters, Sum adds every available input. When parameters
are given, it adds only those parameters/fields. Scalars and ARRAY
values mix freely in one call — an ARRAY input is folded element-by-element
(the same way Min/Max fold arrays), so
GetCDMTableId(@idx, :key)[] => Sum() totals all matched values.
NULL inputs and NULL/empty ARRAY elements are skipped, never poisoning
the total. Output is INT when every value is an integer, otherwise
FLOAT. When every input is an ARRAY the element type is unknown at
parse time, so the output type defers to the destination field.
Sum accepts only numeric (INT/FLOAT) values; dates and strings are
rejected at setup.
Parameters¶
- N —
addendsOptional — accepts: field, FLOAT, INT -
The Nth value to add. May be a field reference (scalar or ARRAY) or a static number.
Input type¶
FLOATINTARRAY
Output type¶
INT when all values are integers, otherwise FLOAT
Requires¶
- All parameter and input types must be numeric (INT or FLOAT).
Examples¶
Sum across all inputs
Two field references
Total a collected ARRAY