Using And/Or and AndAnd/OrOr in Rule Sets
This guide explains the difference between the logical operators And/Or and AndAnd/OrOr in eADM rule sets and provides recommendations on when to use each type.
While the operators can be confusing, a simple guideline is that AndAnd and OrOr provide better performance and are recommended for simple rule sets where you are not mixing conditions.
Operator Definitions
AndAnd / OrOr (Short-Circuit Operators)
The AndAnd and OrOr operators evaluate rules sequentially and stop processing as soon as the overall result can be determined. This is also known as short-circuit evaluation.
AndAnd: If you have a rule
A AndAnd B, and conditionAevaluates tofalse, the system will not evaluate conditionBbecause the entire expression can never betrue.OrOr: If you have a rule
A OrOr B, and conditionAevaluates totrue, the system will not evaluate conditionBbecause the entire expression will always betrue.
Note: Using these operators results in faster processing and is the recommended best practice for simple rule sets.
And / Or (Standard Operators)
The And and Or operators evaluate every rule in the set before returning a final answer. These are used for more complex scenarios where you need to combine different sets of criteria.
Best Practices and Examples
Case 1: Using Only "AND" Logic
If your rule set only contains AND conditions, you should use AndAnd for every rule. This provides the best performance.
Example: A user gets an App-Microsoft365-A3 license if:
Their department number is in a specific list,
ANDTheir position type is
ForV,ANDTheir account is not deactivated.
Case 2: Using Only "OR" Logic
If your rule set only contains OR conditions, you should use OrOr for every rule to gain a similar performance benefit.
Example: A user gets an M365-E5 license if:
Their department number is
3705or1125,ORTheir title is Director, Consultant, or Specialist,
ORThey are a manager for someone.
Case 3: Combining "AND" and "OR" Logic
When you need to mix AND and OR logic, you should use OrOr to separate different sets of criteria, and And to link the rules within each individual set.
In the example below, the rule set consists of two distinct criteria groups separated by OrOr. A user gets the App-Office365-E3 license if they meet the conditions in Group 1 OR the conditions in Group 2.
Group 1 (Lines 1-2):
Department number is in a specific list.
ANDthe account is not deactivated.
Group 2 (Lines 3-5):
The user is a manager.
ANDthe organizational chart does not start with "6000".ANDthe account is not deactivated.