Aggregate
Aggregate your lists
|
|||||
|
|
||||
|
|
||||
|
|
||||
|
|
The Aggregate
building block allows you to sum up values in your table or to perform other calculations that require iterating through all the rows of your table
Use cases
- Sum up values of a given sheet and include them into status reports
Configuration
Click on the bold text in the title of the building block to open the configuration dialog.
After adding the script to your flow, click on the keyboard icon in the input parameter section.
Only unbound input parameters are activated in the form dialog, so if you are using the script multiple times you may need to activate the table and expression parameters.
If you are summing up data of a particular column in your table to calculate the total, you will end up with a new variable holding the calculated value.
Initialize new variables
First of all you'll have to initialize the new variables that you want to create. Use the result prefix when initializing your variables. If you want to create two variables called subtotal
and vat
, you'll have to initialize them like this:
result.vat = 0; result.subtotal = 0;
You may use Ultradox variables in your statements, they will be evaluated before the script gets executed. So in case you want to initialize the subtotal
variable with an existing value you can use an expression like this:
result.vat = 0; result.subtotal = ${startvalue}
Do the math
After initializing the new variables, you can use them in the expression that will be calculated for each row in your data:
result.vat += row.amount * row.quantity * ${vatrate} / 100; result.subtotal += row.amount * row.quantity
Please note that you will have to access the columns by using the row
prefix. To provide your calculations as new variables, they must have the result
prefix.
Make sure to use the new variables without the result
prefix in your template, in this example just use ${vat}
in your template to print the calculated vat.
Questions and Feedback
If you have any comments on this page, feel free to add suggestions right to the Google document that we are using to create this site.
If you are not yet member of the Ultradox community on Google+, please join now to get updates from our end or to provide feedback, bug reports or discuss with other users.
Last Updated: 27.11.17