The Boolean expression is used to test a logical condition according to the rules of boolean logic. For your convenience, BRFplus offers a number of predefined expression templates with two or three operands that cover many use cases. When defining a boolean expression, you replace the formal
operands (<1>
, <2>
etc.) by BRFplus objects that can be evaluated to a boolean value (context data objects of type boolean or expressions with a boolean result data object).
The predefined templates for frequently used logical conditions are:
Any operand is true
All operands are true
<1> and <2>
<1> or <2> or <3>
(<1> and <2>) or <3>
(<1> or <2>) and <3>
<1> and <2> and <3>
The formal structure of the predefined templates is fixed. The only modification you can make is to invert each of the operators (that is, add a logical Not
to the operator, or remove it if already added).
If you have to solve more complex scenarios that are not covered by the predefined templates listed above, you can define your own logical condition by choosing User-defined
template. Here, you are free to define as many operands as you may need. Supported operators
are And
, Or
, and Not
. You can control the logical precedence by enclosing parts of the expression in brackets.
Once you have defined and checked the structure of a user-defined boolean expression, you apply the formal structure to the expression and assign objects or expressions to the operands. Should you feel the need to modify the user-defined structure of your expression at a later point in time, you can easily accomplish this by simply adding more operands or selectively remove some of them. Changing the structure of a boolean expression is supported only for user-defined expressions.
Note
Speaking of user-defined templates might lead you to the idea that a template that you have defined for a user-defined boolean expression could be reused to instantiate more boolean expressions with the same structure. However, this is not possible. If you need to instantiate multiple boolean expressions with the same structure, you can accomplish this by copying the entire boolean expression and assigning a new name to it.