you can also use lock-on-active that will work like no-loop but with multiple rules. <br><br><div class="gmail_quote">On Mon, Jan 11, 2010 at 11:34 AM, Swindells, Thomas <span dir="ltr"><<a href="mailto:TSwindells@nds.com">TSwindells@nds.com</a>></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;">In this case you can simply change your when clause so that it tests whether rules contains Rule1.<br>
<br>
Eg<br>
<div class="im"> rule "Rule1"<br>
salience 100<br>
no-loop true<br>
when<br>
</div> $c:Chesse(type="Chedar" && not (rules contains "Rule1"))<br>
<div class="im"> then<br>
modify ($c){addRule("Rule1")}<br>
end<br>
<br>
</div>Hope that helps,<br>
Thomas<br>
<div><div></div><div class="h5"><br>
> -----Original Message-----<br>
> From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-">rules-users-</a><br>
> <a href="mailto:bounces@lists.jboss.org">bounces@lists.jboss.org</a>] On Behalf Of orchid<br>
> Sent: 11 January 2010 13:21<br>
> To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> Subject: [rules-users] Infinite loop when nesting rules<br>
><br>
><br>
> Hi,<br>
><br>
> I have another question regarding rules nesting. I have the following Rule1<br>
> and Rule2 which check some property of Cheese type (I dont want to merge<br>
> them into one rule). The "then" part of these rules updates the list field<br>
> of class Cheese which holds the rules that were fired for a specific<br>
> instance. In Rule3 I want to check if Rule1 and Rule2 were fired:<br>
><br>
> rule "Rule1"<br>
> salience 100<br>
> no-loop true<br>
> when<br>
> $c:Chesse(type="Chedar")<br>
> then<br>
> modify ($c){addRule("Rule1")}<br>
> end<br>
><br>
> rule "Rule2"<br>
> salience 90<br>
> no-loop true<br>
> when<br>
> $c:Chesse(price < 100)<br>
> then<br>
> modify ($c){addRule("Rule2")}<br>
> end<br>
><br>
> rule "Rule3"<br>
> when<br>
> $c:Cheese(rules contains "Rule1" && rules contains "Rule2")<br>
> then<br>
> System.out.println("Rule3 was fired");<br>
> end<br>
><br>
> Rule1 and Rule2 cause infinite loop because of the 'modify' method. How can<br>
> I solve that issue?<br>
><br>
> Thank you very much in advance !!!<br>
> --<br>
> View this message in context: <a href="http://n3.nabble.com/Infinite-loop-when-nesting-" target="_blank">http://n3.nabble.com/Infinite-loop-when-nesting-</a><br>
> rules-tp116764p116764.html<br>
> Sent from the Drools - User mailing list archive at Nabble.com.<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>
<br>
<br>
</div></div>**************************************************************************************<br>
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the <a href="mailto:postmaster@nds.com">postmaster@nds.com</a> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.<br>
<br>
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00<br>
**************************************************************************************<br>
<br>
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the <a href="mailto:postmaster@nds.com">postmaster@nds.com</a> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes.<br>
To protect the environment please do not print this e-mail unless necessary.<br>
<br>
An NDS Group Limited company. <a href="http://www.nds.com" target="_blank">www.nds.com</a><br>
<div><div></div><div class="h5"><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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> - <a href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br> - <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br> - Salatino "Salaboy" Mauricio -<br>