Agg Ex (Lavastorm) vs Aggregate (D360)
in Lavastorm, Agg Ex, you could group by as well as include other fields to output.. like this:
is there an easy way to do this in the new Aggregate? or do you have to go into the advanced and add them in the configure/process ... Thanks!
Also, how can you do the calculation I have in the output? I think I will need another node?
-
Here is an example using the default data in a Create Data node that aggregates data grouped by the 'type' field's value.
You can initially use the grid editor to generate the individual aggregate values:
Which generates the following output:
Then you need to switch to the Advanced tab of the 'Operations' property. The metadata for the additional fields you want to output are configured in the ConfigureFields script (in the example the 'color' field is being output).
To create a new calculated field you need to define the metadata in the ConfigureFields script (here the 'Total' field being defined as a Python float type - which equates to a double)
The value for the 'Total' field in this case is the sum of the individual aggregate values
Which generates the following output data:
-
You can find additional information on the Aggregate node in your system Help, this is also available online for the latest version of the product here:
Additional detail on the grouping functions used by the Aggregate node can also be found here:
https://doc.infogixsaas.com/analyze/Default.htm#f-script/python/python-modules.htm
-
Because the grid editor was used to define the aggregates it generates the simpler to use constructor where the aggregate object is defined within the ConfigureFields script. Because of this much of the inner-workings of the aggregate functions are implicitly handled by the node meaning the only way to access the 'final' value of the aggregate at 'group end' is using the value assigned to the field in the output record.
The aggregate functions also have an Advanced mode of use where the aggregate object is defined in the ProcessRecords script. In this case the metadata for the output fields that will hold the final aggregate values are defined in the ConfigureFields script. When the first record is being processed by the ProcessRecord script the aggregate objects are defined. Then the aggregate objects are explicitly updated with the current values for each record. As the 'ImplicitWriteEvaluation' property is set to 'Group End' (the default) the output values are only written by the node at the end of each group.
See the 'Advanced Use of Grouping functions' in the Help for further details
The example data flow is attached below.
Attached files
Please sign in to leave a comment.
Comments
5 comments