You&#39;d need to make sure you inform the engine that Order&#39;s price has changed:-<br><br>when<br>    ...<br>then<br>    modify( $o ) {<br>        setPrice( $o.getPrice() - 20);<br>    }<br><br>You could also consider using agenda-groups or lock-on-active to provide your behaviour.<br>
<br><b>agenda-groups<br></b><br> rule &quot;rule 1&quot;<br>//implied default agenda-group of MAIN<br>when<br>    $o : Order (amount&gt;100 &amp;&amp; &lt;200);<br>then<br>    modify( $o ) {<br>        setPrice( $o.getPrice() - 10);<br>
    }<br>    drools.setFocus(&quot;next step in calculation&quot;);<br>end<br><br>rule &quot;rule 2&quot;<br>//implied default agenda-group of MAIN<br>
when<br>    $o:Order (amount&gt;200);<br>
then<br>    modify( $o ) {<br>        setPrice($o.getPrice() - 20);<br>    }<br>    drools.setFocus(&quot;next step in calculation&quot;);<br>
end<br><br>rule &quot;rule 3&quot;<br>agenda-group &quot;next step in calculation&quot;<br>when<br>    $o : Order(....)<br>then<br>    ....<br>end<br><br><b>lock-on-active</b><br><br> rule &quot;rule 1&quot;<br>
//implied default agenda-group of MAIN<br>lock-on-active true<br>
when<br>
    $o : Order (amount&gt;100 &amp;&amp; &lt;200);<br>
then<br>
    modify( $o ) {<br>
        setPrice( $o.getPrice() - 10);<br>
    }<br>
end<br>
<br>
rule &quot;rule 2&quot;<br>
//implied default agenda-group of MAIN<br>

lock-on-active true<br>

when<br>
    $o:Order (amount&gt;200);<br>

then<br>
    modify( $o ) {<br>
        setPrice($o.getPrice() - 20);<br>
    }<br>
end<br>
<br>
rule &quot;rule 3&quot;<br>
agenda-group &quot;next step in calculation&quot;<br>
when<br>
    $o : Order(....)<br>
then<br>
    ....<br>
end<br>
<br><div class="gmail_quote">On 18 March 2011 16:08, Gabor Szokoli <span dir="ltr">&lt;<a href="mailto:szocske@gmail.com">szocske@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
&gt;From what I know, it&#39;s generally better to make the rules idempotent:<br>
In your case introduce a discountedPrice field, leaving the original<br>
price alone.<br>
<br>
If you insist on making it run only once instead, you can introduce a<br>
field or fact class to mark an order &quot;discounted&quot;, then all<br>
discounting rules know to ignore it. (This gets really complicated if<br>
the order amount ever changes and you do need to run the discounting<br>
rules again.)<br>
<br>
<br>
Gabor<br>
<br>
2011/3/18 yong zhao &lt;<a href="mailto:cluncao@yahoo.com.cn">cluncao@yahoo.com.cn</a>&gt;:<br>
<div><div></div><div class="h5">&gt; Hi<br>
&gt; I just try to uses jboss rules in our projects. I met a question. for<br>
&gt; example<br>
&gt; package sample<br>
&gt; rule &quot;rule 1&quot;<br>
&gt; when<br>
&gt;   $o:Order (amount&gt;100 and amount&lt;200);<br>
&gt;  then<br>
&gt; $o.setPrice($o.getPrice()-10);<br>
&gt; end<br>
&gt; rule &quot;rule 2&quot;<br>
&gt; when<br>
&gt;   $o:Order (amount&gt;200);<br>
&gt;  then<br>
&gt; $o.setPrice($o.getPrice()-20);<br>
&gt; end<br>
&gt; if the fact , order&#39;s amount is 210. then the rule2 will be executed, then<br>
&gt; the rule1 will be fired . I want to stop the session once some rule is<br>
&gt; executed or how to control the rule flow.<br>
&gt; thanks in advance<br>
&gt; -Yong<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt;<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>
</blockquote></div><br>