A rule is a set of conditions and associated actions that are performed when the conditions are satisfied.
Rules can be written in two forms:
If and then statements
Decision Tables
For more information, see Decision Table
A rule to determine the bonus to be given to employees based on their performance is as follows:
If |
|
The employee's performance = "good |
|
Then |
|
Grant Bonus = 5% |
Condition
A condition is the "If" part of a rule.
A condition has three components: the LHS (Left-Hand Side) value, the comparator, and the RHS (Right-Hand Side) value.
LHS value or the left side value represents the property of a business object
The comparator represents the comparison that is to be done with the LHS value and RHS value
The RHS value or the right side value represents the measure, quantity, or values against which LHS value is compared
A condition is said to evaluate as true if the LHS value and RHS value satisfy the comparison relationship.
The amount of purchase > 10000
Applicant.isLocalResident = true
Applicant.country = UK
Action
Action is the 'Then' part of a rule. The steps to be taken when a rule is satisfied are collectively called actions.
Actions can be of two categories:
Those related to the application
Those that affect the way other rules are evaluated. This category typically causes more rules to be examined, satisfied, or suppressed. They are primarily meant to control the working of the Engine
If |
|
... |
|
Then |
|
Grant a discount of 10% to the buyer Send an alert 'Stock price jumped beyond the limit' Assert :: Order.getOrderItems Retract :: BusinessObject |
There are six types of actions:
While Execute and Assign relate to the application; Assert, Retract, and Re-evaluate affect the way other rules are evaluated.