Advanced Calculations can be configured in a Calculation Field by entering an expression in the Calculation Expression Field. To learn how to create a Calculation Field, refer to the Creating a Field article.
Example backend Field configuration:
Example front-end view:
Numerical values and operators:
A calculation can include numerical values and standard mathematical operators to compute a value. For example, a Calculation Field could be based on the expression
(1+2)*3 in which case the result would always be 9.
Field placeholders can be entered within an expression string such that other Fields within a Workflow are referenced. The placeholder string ‘%f’ is used to reference a Field. Once ‘%f’ is entered within an expression, a Field will appear allowing you to select the Field to map. You can add as many '%f' placeholders as you need and the corresponding number of input Fields will appear.
In the example below, if the calculation expression entered was
The calculation would add 1 to the value of the Impact Field and multiply the result by 3.
In this example, the calculation expression is
%f * %f
There are 2 placeholders in the Calculation Expression and there are 2 Field Inputs respectively. The value of Impact is multiplied by the value of Likelihood to calculate this Field.
Calculation Field Deletion
Please note that you will receive a warning message when attempting to delete a Calculation Field. This message will require you to confirm whether or not you want to delete the Calculation Field and, along with it, all associated calculations. If you are sure, type the name of the Field within the text box and click the CONFIRM DELETION button.
Methods available are based on the EvalEx library. For example:
1. To take the absolute value of a Field you would enter the expression string:
2. To take the average or sum of multiple fields, you would enter the following expression strings:
3. To round a calculation to a specific number of decimal places you would enter the expression string:
round(your calculation, # of decimals)
round(%f / %f, 2)*100
The expression above would round your calculation to 2 decimals
More information about the methods available can be found here.
Use "if" statements to create calculations based on conditional logic. The basic syntax is below:
condition , exprIfTrue , exprIfFalse)
condition - This is the expression that is used as a condition.
exprIfTrue - If the condition is true, then this expression is evaluated.
exprIfFalse - If the condition is false, then this expression is evaluated instead.