ON THIS PAGE:
Format
If(Condition ,ValueIfTrue ,ValueIfFalse)
Returns
Returns points in the ValueIfTrue expression while the Condition expression evaluates to non-zero (true). Otherwise, returns points in the ValueIfFalse expression while the Condition expression evaluates to zero (false).
Inputs
Condition: The expression to be evaluated.
Behaviour: Required
Dimension: Collection, SingleValue
Valid data types: Boolean, Decimal, Integer
ValueIfTrue: Can evaluate to either a number or a string, but it must evaluate to the same type as ValueIfFalse.
Behaviour: Required
Dimension: Collection, SingleValue
Valid data types: Null, Boolean, DateTime, Decimal, Integer, String, Duration, Error
ValueIfFalse: Can evaluate to either a number or a string, but it must evaluate to the same type as ValueIfTrue.
Behaviour: Required
Dimension: Collection, SingleValue
Valid data types: Null, Boolean, DateTime, Decimal, Integer, String, Duration, Error
Common Traps
ValueIfFalse must evaluate to the same type as ValueIfTrue. E.g. The following expression is not valid:
If({tagname}>=0,{tagname},"Too Low")
Expected result: If the value of {tagname} is greater than or equal to zero, return the value of the tag. Otherwise, return the string "Too Low".
Actual result: This call would fail because {tagname} contains integer or decimal values and mixing those with a string is not allowed.
Examples
Expression: If({tagname}>=0,{tagname},-1)
Result: If the value of {tagname} is greater than or equal to zero, return the value of the tag. Otherwise, return -1.
Expression: If({tagname}==0,{tagname},-1)
Result: If the value of {tagname} is equal to zero, return the value of the tag. Otherwise, return -1.