When using multivalued attributes as conditions in a decision table, make sure you place the condition alternatives in the correct order.
UI Text Box |
---|
type | Warning |
---|
Since a decision table is evaluated by the Blueriq rule engine from left to right, a decision can have an unexpected outcome when the condition alternatives are in the incorrect order. |
See the example below. This decision advises how to prepare yourself by means of clothes or an umbrella in different weather conditions, when going outside.
...
- "What will the advice be when it rains and the wind blows?"
It should be "Wear a raincoat" - "What will the advice be when the sun shines and the wind blows?"
It should be "Wear a coat"
Warning |
---|
|
Image Modified |
When it rains and the wind blows, the advice will be to wear a coat. Evaluated from left to right, the second condition alternative applies:
Warning |
---|
|
Image Modified |
When the sun shines and the wind blows, the advice will be "No dresscode". Evaluated from left to right, the first condition alternative applies:
Warning |
---|
|
Image Modified |
The correct decision table is given below, where the conditions are placed intentionally in the following order: From left to right from means from most complete to least complete.
Tip |
---|
|
Image Modified |
Another option is to use two conditions, both regarding the weather. Blueriq does not prohibit us to do so, which is nice. See below, where all possible combinations are modeled.
Tip |
---|
|
Image Modified |
The choice between the last two decision tables (in green) is a matter of taste. Some prefer the first, some prefer the second.
A downside of the second decision table is that it is highly redundant. It is possible to make use of the fact that Blueriq evaluates decision tables from left to right to shorten the decision table a bit, as shown below, but this is not advised!
Image Removed |
|
Image Added |
UI Text Box |
---|
type |
Info |
---|
Carefully reading the decision table shown above might suggest that when first selecting "Rain" and then "Wind" makes the last condition alternative apply (and therefor Umbrella is advised). However, there is no no first and second in a multivalued attribute, so selecting ["Rain", Wind] is exactly the same as selecting ["Wind","Rain"]. The third condition alternative will apply and in both circumstances, a raincoat is advised. As it should be! |