A decision table is a tabular representation of related rules.
Consider rules with conditions and actions as follows:
If Employee Designation = “Manager” and Employee Performance = “ Good”, then Bonus for Employee = 20
If Employee Designation = “Senior Programmer” and Employee Performance = “ Good”, then Bonus for Employee = 15
If Employee Designation = “Programmer” and Employee Performance = “ Good”, then Bonus for Employee = 10
These rules can be represented in tabular from as follows:
Employee Designation |
Employee Performance |
Employee Bonus |
---|---|---|
Manager |
Good |
20 |
Average |
15 |
|
* |
10 |
|
Senior Programmer |
Good |
15 |
Average |
10 |
|
* |
5 |
|
Programmer |
Good |
10 |
Average |
5 |
|
* |
0 |
This construct is called a decision table in the rules composer. A decision table comprises condition sets and action sets.
Condition Sets
In the decision table, a condition set has a condition header and one or more values. The condition header represents the LHS value in a condition.
Note
A condition is always of the form “LHS value comparator RHS value”. For example “If Employee Designation Equals Manager” is a condition.
In the table above, one of the condition headers is Employee Designation. The corresponding condition values are Manager, Senior Programmer and Programmer. The Condition Value represents the comparator and RHS value in a condition. The default comparator is “ Equals”. Other comparators are: >, >=, <, <=, IN, Like, and BETWEEN.
More Information: List of Comparator Choices for a Decision Table
Action Sets
An action set has an action header and one or more action values. The action header represents a primitive variable definition or a method invocation that takes a single primitive argument. The action value is assigned to the variable definition or passed as an argument to the method being invoked. In the table above, , “Employee Bonus” is an Action Header. The values (20, 15, 10) are the action values.