Logical Functions in Integrator
The Integrator Calc object supports the following logical functions:
Selects between two expressions based on a condition. If condition is true (non-zero), then expr1 is evaluated and becomes the value of the function. Otherwise, expr2 is evaluated.
NOTE: Nested IFs require that all expr’s evaluate to the same data type, e.g. numeric or string.
IF(condition : boolean, expr1 : any, expr2 : any) : variable
For example:
IF(1,200,700) returns 200
IF(0,200,700) returns 700
if(units < 10, "No Discount", if(units < 100, "Level 1 Discount", if(units < 1000, "Level 2 Discount", "Level 3 Discount")))
Returns, when used with IF, the logical AND of all the boolean expressions. It will return true if all of the expressions are true. If one or more of the expressions is false, it will return false.
AND(expr1 : boolean, expr2 : boolean, expr3 : boolean, ...) : boolean
The following example demonstrates the AND function by incorporating it into the IF function. In this example, if Actual Dollars is both larger than 100,000 and smaller than 200,000 the statement is true and the value in the calculation will be 1. Otherwise it will be 0.
IF(AND(Actual Dollars > 100000, Actual Dollars < 200000),1,0)
Returns, when used with IF, the logical OR of the boolean expressions. It will return true if any one of the expressions is true. Otherwise it will return false.
OR(expr1 : boolean, expr2 : boolean, expr3 : boolean, ...) : boolean
The following example demonstrates the OR function by incorporating it into the IF function. In this example, if Actual Dollars is either less than 100,000 or larger than 200,000, but not in between, the statement is true and the value in the calculation will be 1. Otherwise it will be 0.
IF(OR(Actual Dollars < 100000, Actual Dollars > 200000),1,0)
Returns, when used with IF, the logical NOT of the boolean expression. If expr is true, it will return false. If expr is false, it will return true.
NOT(expr : boolean) : boolean
The following example demonstrates that if Actual Dollars is not exactly 100,000, the value in the calculation will be 1. If Actual Dollars is exactly 100,000, the value in the calculation will be 0.
IF(NOT(Actual Dollars = 100000),1,0)