I would like to implement simple rules based on smaller and larger values ββin drools using a decision table.
Simply implement the rules in drl, for example:
rules "less than" when Example(value < 10) then System.out.println("Less than 10") end rules "equals" when Example(value = 10) then System.out.println("Equals 10") end rules "greater than" when Example(value > 10) then System.out.println("Greater than 10") end
But how can I translate it into a decision table in drools? All the examples I've seen so far are comparisons in the status cell. Is it even possible to perform a comparison in a value cell?
The whole example that I saw is in the format:
CONDITION | ACTION Example | value | -----------------------------------|------------------------------------- 10 | System.out.println("equals to 10")
But this applies only to rule 1, and the implementation of the following has a completely different meaning:
CONDITION | CONDITION | CONDITION | ACTION Example value | value > $1 | value < $1 | -----------+------------+------------+---------------- 10 | 10 | 10 | ???
Can the following be done?
CONDITION | ACTION Example | value | -----------------------------------+---------------------------------------- 10 | System.out.println("equals to 10") > 10 | System.out.println("greater than 10") < 10 | System.out.println("less than 10")
What is the correct way to implement these rules?
source share