Feedback

  • Contents
 

Understanding Boolean Expressions

A boolean calculation evaluates a boolean expression, which has a true or false value. Examples of boolean expressions are:

  • CreditScore > 700: True if the value of CreditScore exceeds 700; otherwise false.

  • CreditScore > 700 AND NetYearlyIncome > 30000: True if both expressions are true; otherwise false.

  • CreditScore > 700 OR NetYearlyIncome > 30000: True if either expression is true; false only if both expressions are false.

  • CreditScore > 700 AND NetYearlyIncome > 30000 AND CurrentCustomer = true: True if all three expressions are true; otherwise false.

  • CreditScore > 700 OR NetYearlyIncome > 30000 OR CurrentCustomer = true: True if any or all of theexpressions are true; false only if all of the expressions are false.

  • (CreditScore > 700 AND NetYearlyIncome > 30000) OR CurrentCustomer = true: True if both the first two expressions are true or if the third expression is true; otherwise false.

You can use the Calculation Editor dialog box to create all of the bulleted expressions except for the last expression, which includes both AND and OR. To create complex boolean expressions like that one, you use the Custom Calculation Editor, which you can access by clicking the Enter a custom calculation link at the bottom left corner of the Calculation Editor dialog box.

You can test for only one condition with one variable, or you can test for multiple conditions with multiple variables. Each time you click Plus, IPA Designer adds a variable row to the conditions table in the dialog box. If the table has more than one row, then:

  • The process evaluates the conditions in top-to-bottom order as they appear in the table.

  • The process uses "short-circuit evaluation." When an expression combines multiple conditions by using OR, then the whole expression is true if any of the conditions are true. Therefore, if the first condition is true, the process knows that the whole expression is true and doesn't need to evaluate any of the other conditions. As soon as the process hits a condition that is true, it stops evaluating an OR expression. On the other hand, if an expression combines multiple conditions by using AND, then the whole expression is false if even one of its conditions is false. Therefore, as soon as the process hits a condition that is false, it stops evaluating an AND expression because it knows that the whole expression is false. In either case, the process moves on to the next step.