When you double-click the Script Aggregator function, the function’s configuration dialog opens.
Script Aggregator Configuration Dialog
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. You can add multiple fields in a Group by rule, and then a new session will be created for each unique combination.
Examples - Group by rules
Group by a single field
Group by is set to group the input data based on values in the Day column and you get the following data records:
Record 1: Day=Monday
Record 2: Day=Wednesday
Record 3: Day=Monday
you will get two sessions, one for ‘Monday’ containing two records and one for ‘Wednesday’ containing one record.
Group by two fields
Group by is set to group the input data based on the values in the Day column and the Country column and you get the following data records:
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
You will get three sessions:
one for ‘Monday + Sweden’ with 3 records
one for ‘Monday + France’ with 1 record
one for ‘Wednesday + France’ with 2 records.
Note!
You can add multiple Group by rules. If you have multiple groups and the grouping cannot be performed on the basis of first rule, the next rule will be considered until a match is found. If a record does not match any of the Group by rule(s), 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: