Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to implement less and greater than rules with decision table in drools?
    text
    copied!<p>I would like to implement simple rules based on the less and greater values in drools using decision table.</p> <p>It is easy enough to implement the rules in drl, for example:</p> <pre><code>rules "less than" when Example(value &lt; 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 &gt; 10) then System.out.println("Greater than 10") end </code></pre> <p>But how can I translate it into decision table in drools? All the examples I have seen so far is to have the comparison done in condition cell. Is it even possible to do the comparison in value cell?</p> <p>All example I had seen are in format of:</p> <pre><code>CONDITION | ACTION Example | value | -----------------------------------|------------------------------------- 10 | System.out.println("equals to 10") </code></pre> <p>But that only applies to 1 rule, and doing the following totally has different meaning:</p> <pre><code>CONDITION | CONDITION | CONDITION | ACTION Example value | value &gt; $1 | value &lt; $1 | -----------+------------+------------+---------------- 10 | 10 | 10 | ??? </code></pre> <p>Is even possible to do the following?</p> <pre><code>CONDITION | ACTION Example | value | -----------------------------------+---------------------------------------- 10 | System.out.println("equals to 10") &gt; 10 | System.out.println("greater than 10") &lt; 10 | System.out.println("less than 10") </code></pre> <p>What is the right way to implement these rules?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload