Formulas can contain conditional statements with the basic syntax 'if A is true, then B'. Such statements are enclosed in square brackets.
[condition:value] - if condition is true, the value is returned.
Conditional statements can be grouped:
[condition1:value1] [condition2:value2] [condition3:value3] value4
The above formula is parsed in the following way:
- if condition1 is true, the result is value1, else
- if condition2 is true, the result is value2, else
- if condition3 is true, the result is value3, else
- the result is value4 (if none of the above is true)
Examples:
#MPCENA# * 0.75
|
multiply the retail price by 0.75
|
#PRFAKTOR# * #PRURE#
|
multiply factor from report with corresponding reported hours |
[#KOL# > 100:#MPCENA#*0.8] #MPCENA#
|
if quantity is greater than 100, the price equals MPCENA - 20%. But, if the condition is not met (that is, of quantity is less or equal to 100), the price equals MPCENA.
|
 |
To use the operators 'less than or equal to' and 'greater than or equal to' (not directly available in PANTHEON), use two conditional statements! |
Example:
If A is greater than or equal to B, return 0, else return 1.
would be expressed as
[A>B:0] [A=B:0] 1