Calculation rules are the entry point for every calculation within sumUp.
They define which values should be calculated in which way (sum, average) and how they should be displayed.
Why do I need calculation rules?
Calculation rules are used within sumUp to tell the app which values should be calculated. In addition, you can set the calculation method and several formatting options.
Create a new rule
To create a new calculation rule head over to Manage apps → sumUp calculation rules:
Hit the "Add new rule" button in the upper right corner to open the following pop-up menu:
The field values can either be
- summed up to calculate a total or
- the average can be calculated.
Enter a custom name for the rule.
If nothing is set, the field name will be used as rule name.
In addition, icons for the summation or average can be used in the name for easier identifaction.
Select the number of decimal places to be displayed.
The values will then be rounded accordingly.
Set a custom prefix or suffix to give the user a hint what you are calculating there.
sumUp will by default, takes the field values to be calculated from the Lucene index.
When the checkbox is clicked, the field's value will be calculated at runtime instead.
Activating this setting is useful for scripted or other dynamic fields since the index might contain outdated values at this point. Activating this option will guarantee to always retrieve correct values for those fields.
However, checking this option may cause performance issues because the values have to be re-calculated each time and won't get grabbed from the index.
When e.g. trying to calculate values from a text field that also contains other data, you can use another Input format to specify, how the field value should be processed by sumUp.
When Default is selected, sumUp will just take the field value and tries to calculate it.
When Regular Expression is selected, you can enter a custom regular expression to specify how the field value should be processed:
|Field value||Regular Expression||Evaluated data|
|The average speed was -1.79e5 m/h.||-179000|
When Local number format is selected, you can specify a locale format in which the value should be processed:
|Field value||Locale||Evaluated data|
It is possible to create more than just one rule per field.
By hitting the Primary checkbox the current rule will be used for the calculation. The other rule will then be disabled but not deleted. This way it can be switched between several different rules.
Setting a rule as primary rule is a global setting for sumUp. After changing the primary rule, this rule will be used everywhere in sumUp (like Gagdets, sum rows or sumUp custom fields).