you can also use lock-on-active that will work like no-loop but with multiple rules.

On Mon, Jan 11, 2010 at 11:34 AM, Swindells, Thomas <TSwindells@nds.com> wrote:
In this case you can simply change your when clause so that it tests whether rules contains Rule1.

Eg
 rule "Rule1"
 salience 100
 no-loop true
  when
    $c:Chesse(type="Chedar" && not (rules contains "Rule1"))
  then
    modify ($c){addRule("Rule1")}
 end

Hope that helps,
Thomas

> -----Original Message-----
> From: rules-users-bounces@lists.jboss.org [mailto:rules-users-
> bounces@lists.jboss.org] On Behalf Of orchid
> Sent: 11 January 2010 13:21
> To: rules-users@lists.jboss.org
> Subject: [rules-users] Infinite loop when nesting rules
>
>
> Hi,
>
> I have another question regarding rules nesting. I have the following Rule1
> and Rule2 which check some property of Cheese type (I dont want to merge
> them into one rule). The "then" part of these rules updates the list field
> of class Cheese which holds the rules that were fired for a specific
> instance. In Rule3 I want to check if Rule1 and Rule2 were fired:
>
> rule "Rule1"
> salience 100
> no-loop true
>   when
>     $c:Chesse(type="Chedar")
>   then
>     modify ($c){addRule("Rule1")}
> end
>
> rule "Rule2"
> salience 90
> no-loop true
>   when
>     $c:Chesse(price < 100)
>   then
>     modify ($c){addRule("Rule2")}
> end
>
> rule "Rule3"
>   when
>     $c:Cheese(rules contains "Rule1" && rules contains "Rule2")
>   then
>     System.out.println("Rule3 was fired");
> end
>
> Rule1 and Rule2 cause infinite loop because of the 'modify' method. How can
> I solve that issue?
>
> Thank you very much in advance !!!
> --
> View this message in context: http://n3.nabble.com/Infinite-loop-when-nesting-
> rules-tp116764p116764.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com 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.

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
**************************************************************************************

This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com 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.

An NDS Group Limited company. www.nds.com

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
- http://salaboy.wordpress.com
- http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -