Script Aggregator Configuration
When you double-click the Script Aggregator function, the function’s configuration dialog opens.
Group by
Select the field(s) in the input data (displayed as columns in the interface) that you want to group the data by. For example, if you select Day, a session will be created for each unique value for Day contained in the input data. Each row of Fields is a Group by rule, and you can add multiple fields in each rule. A new session will be created for each unique combination.
Example- Group by rules
Group by a single field
The field ‘day’ is added to a Group by rule. This will group the input data based on values in the day column. The following data records are received:
Record 1: Day=Monday
Record 2: Day=Wednesday
Record 3: Day=Monday
Result: Two sessions are created
One for Monday containing 2 records
One for Wednesday containing 1 record
Group by two fields
The fields ‘day’ and 'country' are added to a Group by rule. This will group the input data based on values in the day column and the country column. The following data records are received:
Record 1: Day=Monday, Country=Sweden
Record 2: Day=Wednesday, Country=France
Record 3: Day=Monday, Country=France
Record 4: Day=Monday, Country=Sweden
Record 5: Day=Wednesday, Country=France
Record 6: Day=Monday, Country= Sweden
Result: Three sessions are created:
One for 'Monday + Sweden’ containing 3 records
One for ‘Monday + France’ containing 1 record
One for ‘Wednesday + France’ containing 2 records.
Note!
You can also add multiple Group by rules. If the grouping cannot be performed based on the first rule, the next rule will be considered until a match is found. If a record does not match any of the Group by rules, the stream will abort.
If you do not specify anything in Group by, aggregation will be performed based on all the columns.
Script block
You can define the custom logic using the following tabs: