IfCondition options are used in any measure, of any type, to evaluate a mathematical formula. The formula will be evaluated as "true" or "false", and will execute IfTrueAction or IfFalseAction action options, which will contain one or more Bangs or commands.
Note: IfCondition can only be used to evaluate a numeric mathematical formula. No string values may be used in the condition test. See IfMatchActions to test and take action on string values.
The formula uses the same syntax as described on the Formulas page but does not need to be surrounded in parenthesis. Like the Calc measure, measure names do not need [brackets] and are always dynamic when referenced inside the IfCondition.
There can be multiple sets of condition and action options in the measure, by using IfCondition2 / IfTrueAction2 / IfFalseAction2 and so on.
IfConditions are similar in functionality to IfActions, with a few important and powerful differences.
- The formula is not based on the value of the measure the IfCondition is in, but can reference any measures, variables or section variables.
- There can be an IfTrueAction, IfFalseAction or both for each IfCondition, so you can take appropriate actions not only when the result is "true", but also when it is "false".
- The syntax allows for a single IfCondition to embed logical AND
||comparisons in the formula. Unlike IfEqualValue for instance, which allows for a single comparison, you could use
IfCondition=(MeasureName = 5) || (MeasureName = 10), to check if the value of MeasureName is "5" OR "10". You can also use the full range of logical operators, so rather than being limited to "equal", "above" or "below", you can use any of
A mathematical formula, which when evaluated will result in "true" or "false".
IfCondition=MeasureName >= 10
IfCondition=MeasureOne = (MeasureTwo + #VarName#) / 2
IfCondition=(MeasureName > 5) && (MeasureName < 10)
IfCondition=(MeasureName = 25) || (MeasureName = 50) || (MeasureName = 75)
Note: The comparison on either side of logical AND
||operators must be enclosed in (parentheses).
Optional action to be executed when the formula expressed in IfCondition results in "true". The action is executed only once when the condition becomes "true", so it needs to become "false" and again "true" to execute again.
Optional action to be executed when the formula expressed in IfCondition results in "false". The action is executed only once when the condition becomes "false", so it needs to become "true" and again "false" to execute again.
If set to
1, the evaluation of the condition will execute the appropriate actions in IfTrueAction or IfFalseAction on every update of the measure.
Note: Care should be taken not to create an infinite loop in the actions. In particular,
!UpdateMeasure #CURRENTSECTION#should generally be avoided when