Today, on this list, I posted a way of getting the DRL from a decision table. We should see the rules that are generated for the 2nd rule table.<br><br>And see below...<br><br><br><div class="gmail_quote">On 10 February 2011 18:11, groovenarula <span dir="ltr">&lt;<a href="mailto:gnarula1@la-z-boy.com">gnarula1@la-z-boy.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
rule &quot;Set F103 Option price based on Group/Style&quot;<br>
        salience 50<br>
        when<br>
                $unit : Unit (  group == &quot;010&quot;, style == &quot;315&quot; )<br>
                $option : Option (unit == $unit )<br>
                          Option (optionPrice == null, code == &quot;F103&quot; )<br></blockquote><div><br>This doesn&#39;t look right. I&#39;d expect<br><br>   $option : Option (unit == $unit, optionPrice == null, code == &quot;F103&quot; )<br>
<br>-W<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
        then<br>
<br>
            $option.setOptionPrice(120.00);<br>
            retract ( $option );<br>
end<br>
<br>
rule &quot;Set F103 Option base price&quot;<br>
        salience 5<br>
        when<br>
                $option : Option ( optionPrice == null, code == &quot;F103&quot; )<br>
        then<br>
                $option.setOptionPrice(100.00);<br>
                retract ( $option );<br>
end<br>
<br>
Question : Is there a better way to implement the rules stated above ?<br>
<br>
The DRL works as expected when I insert one or multiple items in working<br>
memory. The appropriate rules fire and when Group / Style = 010 / 315, the<br>
price for the option is set to 120, but when Group and Style is anything<br>
else, the option does get priced at 100.00.<br>
<br>
However, when I try to implement the same rule using decision tables, I get<br>
different results. To implement the above, I created 2 rule tables :<br>
<br>
1. The first rule table establishes the pricing of options that are not<br>
specific to a group / style as follows:<br>
<br>
CONDITION                                                  PRIORITY<br>
ACTION<br>
$option : Option<br>
code == &quot;$param&quot;, optionPrice == null               5<br>
$option.setOptionPrice($param); retract($option)<br>
<br>
2. A second rule table that adds the unit constraints as follows (with<br>
PRIORITY 50):<br>
<br>
CONDITION              CONDITION              CONDITION<br>
$unit : Unit                                              $option : Option<br>
group == &quot;$param&quot;  style == &quot;$param&quot;     unit == $unit, code == &quot;$param&quot;,<br>
optionPrice == null<br>
<br>
ACTION<br>
$option.setOptionPrice($param); retract ( $option);<br>
<br>
There in lies my dilemma.<br>
<br>
When I send one unit with Group Style 010 315 and option F103, it prices the<br>
option properly @ 120.00.<br>
<br>
When I send in a unit with a different style (same group = 010), it also<br>
prices the option properly at 100.<br>
<br>
When I when I send 2 units together - one with group and style 010 315 and<br>
another having the same group but a different style (515 for example), it<br>
prices the option for both units @ 120 :<br>
<br>
   010 315 option price = 120.00 (correct result)<br>
   010 515 option price = 120.00 (wrong result)<br>
<br>
But if the second unit on the 2 units has a different group (011 for<br>
example), I get the right option prices :<br>
 010 315 option price = 120.00 (correct result)<br>
 011 315 option price = 100.00 (correct result)<br>
<br>
For what ever reason, it does not fire the generic pricing option even<br>
though the second unit&#39;s G/S does not match 010 315.<br>
<br>
Can anyone please shed some light on what I&#39;m doing wrong here ?<br>
<br>
Any help will be appreciated.<br>
<br>
Thanks in advance.<br>
Gurvinder<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Getting-different-results-from-decision-tables-based-on-number-of-facts-all-other-fact-information-s-tp2467364p2467364.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Getting-different-results-from-decision-tables-based-on-number-of-facts-all-other-fact-information-s-tp2467364p2467364.html</a><br>

Sent from the Drools - User mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>