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.
The Calculation Expression can contain numerical values, mathematical operators, Field placeholders, and methods based on the EvalEx Library.
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.
4. To set a variable as the value of an input you would enter a string similar to this:
(variable = %f) * variable
This is equivalent to this, but allows you to only select the input once:
%f * %f
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.
It is important that you use
== to set a field equal to a specified value in Conditional If statements. In the EvalEx Library, the Operator
= is best suited for setting variables, not equivalency.
For example, if we wanted an expression that reads "If a field is equal to 5, then make it 1, else make it 0", it would be input like the following:
if( %f==5 , 1 , 0 ) .
If you want to add in
OR statements to the above expression it would look similar to:
if(%f==5 && %f==2, 1, 0) or
if(%f==5 || %f==2, 1, 0). These expressions read as: "If Field Input 1 is equal to 5 AND Field Input 2 is equal to 2, then 1, else 0" and "If Field Input 1 is equal to 5 OR Field Input 2 is equal to 2, then 1, else 0".
Please find a list of Boolean Operators that are supported by EvalEx below.
Equals (Variable Setting)
Equals (Equivalent to)
Less than or equal to
Greater than or equal to