Aggregate

We assume that you have already learned what is described in:

If you want to find the right Transformer for your purposes, see Transformers Comparison.

Short Summary

Aggregate computes statistical information about input data records.

Component Same input metadata Sorted inputs Inputs Outputs Java CTL
Aggregate-no1nnono

Abstract

Aggregate receives data records through single input port, computes statistical information about input data records and sends it to single output port.

Icon

Ports

Port typeNumberRequiredDescriptionMetadata
Input0yesFor input data recordsAny1
Output0yesFor statistical informationAny2

Aggregate Attributes

AttributeReqDescriptionPossible values
Basic
Aggregation mapping Sequence of individual mappings for output field names separated from each other by semicolon. Each mapping can have the following form: $outputField:=constant or $outputField:=$inputField (this must be a field name from the Aggregate key) or $outputField:=somefunction($inputField). 
Aggregate key Key according to which the records are grouped. See Group Key for more information. 
Charset Encoding of incoming data records.ISO-8859-1 (default) | other encoding
Sorted input By default, input data records are supposed to be sorted acoording to Aggregate key. If they are not sorted as specified, switch this value to false.true (default) | false
Equal NULL By default, records with null values are considered to be different. If set to true, records with null values are considered to be equal.false (default) | true
Deprecated
Old aggregation mapping Mapping that was used in older versions of CloudConnect, its use is deprecated now. 

Advanced Description

Aggregate Mapping

When you click the Aggregation mapping attribute row, an Aggregation mapping wizard opens. In it, you can define both the mapping and the aggregation. The wizard consists of two panes. You can see the Input field pane on the left and the Aggregation mapping pane on the right.

  1. Select each field that should be mapped to output by clicking and drag and drop it to the Mapping column in the right pane at the row of the desired output field name. After that, the selected input field appears in the Mapping column. This way you can map all the desired input fields to the output fields.

  2. In addition to it, for such fields that are not part of Aggregate key, you must also define some aggregation function.

    Fields of Aggregate key are the only ones that can be mapped to output fields without any function (or with a function).

    Thus, the following mapping can only be done for key fields: $outField=$keyField.

    On the other hand, for fields that are not contained in the key, such mapping is not allowed. A function must always be defined for them.

    To define a function for a field (contained in the key or not-contained in it), click the row in the Function column and select some function from the combo list. After you select the desired function, click Enter.

  3. For each output field, a constant may also be assigned to it.

Example 55.1. Aggregation Mapping

$Count=count();$AvgWeight:=avg($weight);$OutFieldK:=$KeyFieldM;$SomeDate:=2008-08-28

Here:

  1. Among output fields are: Count, AvgWeight, OutFieldK, and SomeDate. Output metadata can also have other fields.

  2. Among input fields are also: weight, and KeyFieldM. Input metadata can also have other fields.

  3. KeyFieldM must be a field from Aggregate key. This key may also consist of other fields.

    weight is not a field from Aggregate key.

    2008-08-28 is a constant date that is assigned to output date field.

    count() and avg() are functions that can be applied to inputs. The first does not need any argument, the second need one - which is the value of the weight field for each input record.