Logical operators in InfoMaker expressions

You use logical operators to combine boolean expressions into a larger boolean expression. The result is always true or false:

Table 23-9: Using expressions with logical operators

Operator

Meaning

Example

NOT

Logical negation.

If A is true, NOT A is false. If A is false, NOT A is true.

NOT Price = 100

AND

Logical and.

A AND B is true if both are true. A AND B is false if either is false.

Tax > 3 AND Ship < 5

OR

Logical or.

A OR B is true if either is true or both are true. A OR B is false only if both are false.

Tax > 3 OR Ship < 5

When you combine two or more boolean expressions to form a new expression, the new expression is either true or false. The following truth table shows how true and false expressions are evaluated to form an expression that is either true or false.

For example, if "My dog has fleas" is true and "My hair is brown" is false, then "My dog has fleas OR my hair is brown" is true, and "My dog has fleas AND my hair is brown" is false:

Table 23-10: Combining expressions with logical operators

If one expression has this value

And the logical operator is

And if another expression has this value

The resulting expression has this value

TRUE

AND

TRUE

TRUE

TRUE

AND

FALSE

FALSE

FALSE

AND

TRUE

FALSE

FALSE

AND

FALSE

FALSE

TRUE

OR

TRUE

TRUE

TRUE

OR

FALSE

TRUE

FALSE

OR

TRUE

TRUE

FALSE

OR

FALSE

FALSE

NOT TRUE

AND

TRUE

FALSE

NOT TRUE

AND

FALSE

FALSE

NOT FALSE

AND

TRUE

TRUE

NOT FALSE

AND

FALSE

FALSE

NOT TRUE

OR

TRUE

TRUE

NOT TRUE

OR

FALSE

FALSE

NOT FALSE

OR

TRUE

TRUE

NOT FALSE

OR

FALSE

TRUE

If you use a logical operator with a boolean function that returns null, the term with the null return value is evaluated as false. If you use the NOT logical operator with a boolean function that returns null, the complete term evaluates to true. For example, "NOT gf_boolean ()" evaluates to true when gf_boolean () returns null.