-
A numeric value (integer or decimal), such as 1.1 or 23000.
-
A string value enclosed in double quotes, for example:
"NY"
Important:
The double quotes are required.
-
A value of a context property. Recall that a BPL business process can contain a general-purpose, persistent variable called context. You define the context variable using the <context> and <property> elements of BPL. You can access the properties of the context object from anywhere in the business process. Therefore, if you invoke a rule from a business process using the <rule> element, you can access the context properties from within the rule.
For context properties that contain collections such as lists and arrays, InterSystems IRIS supports several retrieval methods from within business rules, including Count(), Find(), GetAt(), GetNext(), GetPrevious(), IsDefined(), Next(), and Previous(). For more information, see Working with Collections.
Note:
Property names are case-sensitive and must not be enclosed in quotes, for example, PlaceOfBirth.
-
An expression using supported operators, literal values, properties of the general-purpose, and persistent variable contextfor example:
((2+2)*5)/154.3
"hello" & "world"
Age * 4
(((x=1) || (x=3)) && (y=2))
-
A built-in function such as Min(), Max(), Round(n,m), or SubString(). The function name must include parentheses. It must also include any input parameters, such as the numeric values n and m for Round. If there are no input values for the function, then the open and close parentheses must be present and empty.
-
The Document variable, which represents the message object.
-
Within a foreach action, a segment. For more information, see About Actions.
Editing the Condition Property of an if Clause
In a rule definition, a condition consists of two values and a comparison operator between the values, for example:
If a condition is not true, it is false. There are no other possible values for the condition property. A result that may be only true or false is called a boolean result. InterSystems IRIS stores boolean results as integer values, where 1 is true and 0 is false. In most cases, you do not need to use this internal representation. However, for a routing rule, you may want to execute the if clause that corresponds to the condition property any time the constraint for the rule holds true. In this case, you can set the condition property to 1.
A condition property can contain more than one condition. InterSystems IRIS evaluates and compares all the conditions in the property before determining whether to execute the corresponding rule. The logic between conditions is determined by AND or OR operators. For example, consider a condition property with the following value:
IF Amount <= 5000
AND CreditRating > 5
OR CurrentCustomer = 1
The same value appears in the Rule Editor as follows
The value contains three conditions: Amount <= 5000, CreditRating > 5, CurrentCustomer = 1. Each condition could be true or false. InterSystems IRIS evaluates the conditions individually before evaluating the relationships between them defined by the AND and OR operators.
The AND and OR operators can operate only on true and false values. That is, the operators must be positioned between two boolean values and return a single boolean result as follows:
Operator |
Result is true when... |
AND |
Both values are true. |
OR |
At least one of the values is true, or both are true. If one of the values is false and the other is true, then the result (as a whole) is still true. |
If a condition property contains multiple AND or OR operators, the AND operators take precedence over the OR operators. Specifically, all the AND operations are performed first. Then, the OR operations are performed. For example, consider the following set of conditions:
IF Amount <= 5000
AND CreditRating > 5
OR CurrentCustomer = 1
AND CreditRating >= 5
The same set of conditions appears in the Rule Editor as follows:
InterSystems IRIS evaluates the conditions as follows:
IF (Amount <= 5000 AND CreditRating > 5)
OR (CurrentCustomer = 1 AND CreditRating >= 5)
That is, the whole set of conditions is true if either or both of the following statements is true:
-
Someone requests an amount less than 5,000 and has a credit rating better than average.
-
A current bank customer requests any amount and has a credit rating greater than or equal to the average.
If both statements are false, then the set of conditions (as a whole) is false.
To explain another way, InterSystems IRIS evaluates the set of conditions by taking the following steps:
-
Determine whether the result of the following AND expression is true or false:
IF Amount <= 5000
AND CreditRating > 5
Suppose this result is called “SafeBet.”
-
Determine whether the result of the following AND expression is true or false:
IF CurrentCustomer = 1
AND CreditRating >= 5
Suppose this result is called “KnownEntity.”
-
Determine whether the result of the following OR expression is true or false:
IF SafeBet is true
OR KnownEntity is true
If SafeBet is true and KnownEntity is false, then the set of conditions is true. Similarly, if SafeBet is false and KnownEntity is true, then the set of conditions is true. Lastly, if both SafeBet and KnownEntity are true, then the set of conditions is true.
Expression Operators
When defining an expression, you can select one of the follow arithmetic operators:
Operator |
Meaning |
+ |
Plus (binary and unary) |
– |
Minus (binary and unary) |
* |
Times |
/ |
Divide |
Additionally, the following logical operators are supported and return an integer value of 1 (true) or 0 (false):
Operator |
Meaning |
Expression is true when... |
AND (&&) |
And |
Both values are true. |
OR (||) |
Or |
At least one of the values is true. Both values may be true, or only one true. |
! |
Not (unary) |
The value is false. |
= |
Equals |
The two values are equal. |
!= |
Does not equal |
The two values are not equal. |
> |
Is greater than |
The value to the left of the operator is greater than the value to the right of the operator. |
< |
Is less than |
The value to the left is less than the value to the right. |
>= |
Is greater than or equal to |
The value to the left is greater than the value to the right, or if the two values are equal. |
<= |
Is less than or equal to |
The value to the left is less than the value to the right, or if the two values are equal. |
[ |
Contains |
The string contains the substring to the right. Pattern matching for Contains is exact. If the value at left is “Hollywood, California” and the value at right is “od, Ca”, there is a match, but a value of “Wood” does not match. |
Lastly, you can use the following string operators:
Operator |
Meaning |
& |
Concatenation operator for strings. |
_ |
Binary concatenation to combine string literals, expressions, and variables. |
When more than one operator is found in an expression, the operators are evaluated in the following order of precedence, from first to last:
-
Any of the following logical operators: ! = != < > <= >= [
-
Multiplication and division: * /
-
Addition and subtraction: + –
-
String concatenation: & _
-
Logical AND: &&
-
Logical OR: ||