Aggregate functions perform operations on a set, or sequence, of input values. The input data for min, max, sum and avg is converted to the decimal data type for processing.
|•||The input values must be connected to the values parameter of the function.|
|•||A context node (item) can be connected to the parent-context parameter to override the default context from which the input sequence is taken. The parent-context parameter is optional.|
|•||The result of the function is connected to the specific target item.|
The mapping shown below is available as Aggregates.mfd in the ...\Tutorial folder and shows how these functions are used.
Aggregate functions have two input items.
|•||values (nodes/rows) is connected to the source item that provides the data, in this case Number.|
|•||parent-context is connected to the item you want to iterate over, i.e. the context, in this case over all Customers. The parameter is, however, optional.|
The input instance in this case is an XML file containing the following data:
|•||The source data supplied to the values item is the number sequence 2,4,6,8.|
|•||The output component in this case is a simple text file.|
Clicking the Output tab for the above mapping delivers the following result:
min=2, max=8, count=4, sum=20 and avg=5.
© 2019 Altova GmbH