Bruke Og/Eller og OgOg/EllerEller i regelsett
This guide explains the difference between the logical operators Og
/Eller
og 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
og OrOr
provide better performance and are recommended for simple rule sets where you are not mixing conditions.
Operator Definitions
AndAnd / OrOr (Short-Circuit Operators)
Den AndAnd
og 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 conditionA
evaluates tofalsk
, the system will not evaluate conditionB
because the entire expression can never betrue
.OrOr: If you have a rule
A OrOr B
, and conditionA
evaluates totrue
, the system will not evaluate conditionB
because 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)
Den Og
og Eller
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.
Eksempel: A user gets an App-Microsoft365-A3
license if:
Their department number is in a specific list,
AND
Their position type is
F
ellerV
,AND
Their 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.
Eksempel: A user gets an M365-E5
license if:
Their department number is
3705
eller1125
,OR
Their title is Director, Consultant, or Specialist,
OR
They are a manager for someone.
Case 3: Combining "AND" and "OR" Logic
When you need to mix AND
og OR
logic, you should use OrOr
to separate different sets of criteria, and Og
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.
AND
the account is not deactivated.
Group 2 (Lines 3-5):
The user is a manager.
AND
the organizational chart does not start with "6000".AND
the account is not deactivated.