Skip to main content

Aggregate (Array Calculation Mapping)

The ArrayCalculationMapping is used to aggregate numerical values from a message field. It calculates the maximum, minimum, total, and average of the numbers found in the specified field. To define an array calculation mapping, ensure the function type is set to "Numeric functions" and the function is set to "aggregate".

The attributes that need to be set in an array calculation mapping are:

AttributeRequiredDescription
fromYDefines the source field name where the numbers are located.
toYDefines the target field name where the results will be stored.
Function typeYDefines the type of mapping. Needs to be "Numeric functions".
FunctionYDefines the mapping type. Needs to be "aggregate".

Aggregation Results

The following values are calculated during aggregation and stored in the specified target path:

ResultDescription
maxThe maximum value found in the array.
minThe minimum value found in the array.
totalThe sum of all the values in the array.
avgThe average of the values in the array.

Example

If an incoming message contains a field with an array of numbers

{
"numbers": [5.5, 12.3, 7.8, 3.0]
}

The mapping would aggregate the values as follows:

{
"results": {
"max": 12.3,
"min": 3.0,
"total": 28.6,
"avg": 7.15
}
}