For general rule help see Rule Engine Introduction
The Rule Engine supports operators for boolean expressions and string concatenation. There is NO support for standard order of operations. Operators are simply applied in greedy fashion from left to right. For this reason, when you use multiple operators it is usually wise to enclose them with parentheses to indicate the desired order of application.
Concatenation and Addition
Rules may be joined with the '+' operator to perform string concatenation or numeric addition.
The '+' operator will perform numeric addition if both left and right arguments are intrinsically numeric (long or double).
In all other cases the arguments are converted to strings and concatenated.
To force concatenation, you may first concatenate with an empty string e.g. (1 + "") + 2
For comparison operators you often care about the type of the values being compared. This especially true of numeric and time comparisons. Comparison operators will coerce both operands based on the type of the first operand. Compare the following two examples:
Now().TimeOfDay > "12:00:00" ---> 9:23:12 > 12:00:00 ---> false "12:00:00" < Now().TimeOfDay ---> "12:00:00" < "9:23:012" ---> true
Generally, it is a good idea use coercion functions on operands where the type might be an issue:
CoerceTimeSpan("12:00:00") < Now().TimeOfDay
Boolean operators support short-circuit evaluation, although in many cases it makes more sense to use Boolean functions instead (which also support short-circuit evaluation), because it can give improved legibility when chaining multiple expressions.
BitAnd(context.Attributes.userAccountControl, 512) > 0
context.DN == "John Doe"
Length(context.Attributes.employeeID) >= 5
5 <= Length(context.Attributes.employeeID)
"John Doe started " + Now() + " with Emplid " + 12345
((givenName && sn) || (preferredName && sn)) + " true or false"