Logical Operations and Comparisons
When defining a condition, you can include logical operators, comparison operators, and the data map entry state operator. These operators can be used to define special conditions in a conditional, whileLoop, or dataService business rule component, or to define an executionCondition in any type of business rule component. Each operation results in a value of true or false, and you can nest operations to produce complex expressions.
Important! Content in a business rule is case sensitive. This includes business rule component names, attributes, and values.
About the syntax documentation
Logical Operators
You can use the following logical operators.
Operator | Description |
---|---|
and | The result is true if the results of all child operations are true. |
nand | The result is true if the result of at least one child operation is false. |
or | The result is true if the result of at least one child operation is true. |
nor | The result is true if the results of all child operations are false. |
The following is the syntax for logical operations that can be used when defining a condition.
<and|nand|or|nor failOnFalseCondition="false|true">
<falseLogMessage>Text written to log if condition is false</falseLogMessage>
<trueLogMessage>Text written to log if condition is true</trueLogMessage>
<!-- Optional. Child operations can be nested to produce a more complex expression. Each operation results in a condition of true or false. -->
</and|nand|or|nor>
Comparison Operators
You can use the following comparison operators.
Tip: Comparison of DATE values is supported using the equals, greaterThan, lessThan, and notEquals operators.
Operator | Description |
---|---|
equals |
The result is true if the left and right values are equal. This comparison is case sensitive. |
notEquals |
The result is true if the left and right values are not equal. This comparison is case sensitive. |
equalsIgnoreCase |
The result is true if the left and right values are equal. This comparison is case insensitive. |
notEqualsIgnoreCase |
The result is true if the left and right values are not equal. This comparison is case insensitive. |
greaterThan |
The result is true if the left value is greater than the right value. This comparison is case sensitive. |
lessThan |
The result is true if the left value is less than the right value. This comparison is case sensitive. |
Important! Specifying the type is required for each value being compared. Depending on the type, that value can be interpreted as a literal value or as a data map entry name (key).
Note: If you use an empty string as a value in a comparison, it is interpreted as a null value A value that is unknown. A null value is different from an empty string or a zero value. instead. You can test for an empty string by using a mapState operator with stateCheck="NOT_EMPTY" and inverseResult="true".
Note: A comparison operator cannot have child business rule components.
The following is the syntax for comparison operations that can be used when defining a condition.
<equals|notEquals|equalsIgnoreCase|notEqualsIgnoreCase|greaterThan|lessThan failOnFalseCondition="false|true">
<falseLogMessage>Text written to log if condition is false</falseLogMessage>
<trueLogMessage>Text written to log if condition is true</trueLogMessage>
<!-- When defining the left, a value is required for type. -->
<left type="KEY|LITERAL" valueType="STRING|INTEGER|BOOLEAN|NUMBER|BINARY|DATE">
<value>Value_to_compare</value>
</left>
<!-- When defining the right, a value is required for type. -->
<right type="KEY|LITERAL" valueType="STRING|INTEGER|BOOLEAN|NUMBER|BINARY|DATE">
<value>Value_to_compare</value>
</right>
</equals|notEquals|equalsIgnoreCase|notEqualsIgnoreCase|greaterThan|lessThan>
Data Map Entry State Operator
You can use the data map entry state operator to determine whether a specified data map entry exists and whether it contains a value.
Note: When using a mapState operator, you must specify a the name of a data map entry as the value for key. A data map entry state operator cannot have child business rule components.
Operator | Description |
---|---|
mapState |
The result is true if the data map entry specified by key has the state specified by stateCheck and the result is not inverted. If the result is inverted, then the result is true if the data map entry specified by key does not have the state specified by stateCheck. |
The following is the syntax for a data map entry state operation that can be used when defining a condition.
<mapState failOnFalseCondition="false|true"
key="Path" stateCheck="EXISTS|NOT_NULL|NOT_EMPTY" inverseResult="false|true">
<falseLogMessage>Text written to log if condition is false</falseLogMessage>
<trueLogMessage>Text written to log if condition is true</trueLogMessage>
</mapState>
Syntax Tips
Additional information is available about the following items.
Tip: For assistance with a business rule that you have created or to have Loftware create business rules for you, contact Loftware's Professional Services Group.