<br> Also, if each of your steps involve multiple rules, the best way to coordinate "phased" execution is to use ruleflow.<br><br> Edson<br><br><div class="gmail_quote">2009/11/23 Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Without salience, there is no guarantee that rule 1 will fire before rule 2.<br>
<br>
Seeing only part of the problem makes it difficult to shell out good advice.<br>
<font color="#888888"><br>
-W<br>
</font><div><div></div><div class="h5"><br>
On 11/23/09, Greg Barton <<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>> wrote:<br>
> The reason rule 2 is executed even though rule 1 has fired is because you're<br>
> not notifying the engine that the CustomerDetail has been changed. You need<br>
> the statement "update(d)" in the rule action. (And this is generally true<br>
> when you modify matched objects in a rule. Only leave it out in the rare<br>
> circumstance when you do NOT want other rules to be triggered by a change.)<br>
><br>
> Also, an alternative to your approach is using agenda-group. Check the<br>
> docs.<br>
><br>
> --- On Mon, 11/23/09, Lindy hagan <<a href="mailto:lindyhagan@gmail.com">lindyhagan@gmail.com</a>> wrote:<br>
><br>
>> From: Lindy hagan <<a href="mailto:lindyhagan@gmail.com">lindyhagan@gmail.com</a>><br>
>> Subject: [rules-users] Could anyone suggest alternate approach<br>
>> To: "Rules Users List" <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
>> Date: Monday, November 23, 2009, 11:56 AM<br>
>> Please ignore my previous email as I<br>
>> did not include subject.<br>
>><br>
>> I have 4 drl files in my app. Loading all the 4 during<br>
>> application startup.<br>
>> If any rule is satisfied in File 1,I don't want File 2<br>
>> be called.Should execute File 3 and 4.<br>
>> Similarly If rules in File 1 is not satisfied,want to call<br>
>> File 2 then File 3 and 4.<br>
>><br>
>> At present I am doing this way.Please let me know if<br>
>> this is ok or if there is any better solution.<br>
>> Set an attribute when a rule is satisfied. (attribute is<br>
>> not dummy,I need it in my app)<br>
>> Attribute is checked in each and every if it is null.<br>
>><br>
>> Example File1.drl contains 2 rules.If first rule is<br>
>> satisfied, don't want to execute second rule.So setting<br>
>> rule with a valid number.<br>
>><br>
>> File1.drl<br>
>> rule "1.Age Factor and Junior"<br>
>> when<br>
>> d : CustomerDetail( rule == ""<br>
>> && sale == 'Junior' && age in<br>
>> ("16","17"))<br>
>> then<br>
>><br>
>> System.out.println("Junior and Age Satisfied<br>
>> ");<br>
>> d.setRule("1");<br>
>> end<br>
>> rule "2.Junior only Age Factor"<br>
>> when<br>
>> m : CustomerDetail( rule == ""<br>
>> && age in ("16","17"))<br>
>> then<br>
>> System.out.println("Only junior Age<br>
>> satisfied.");<br>
>><br>
>> m.setRule("2");<br>
>> end<br>
>><br>
>> File2.drl<br>
>> rule "3.Age Factor and Senior"<br>
>> when<br>
>> d : CustomerDetail( rule == ""<br>
>> && sale == 'Senior' && age in<br>
>> ("70","75"))<br>
>> then<br>
>><br>
>> System.out.println("Senior and Age Satisfied<br>
>> ");<br>
>> d.setRule("10");<br>
>> end<br>
>> rule "4.Senior only Age Factor "<br>
>> when<br>
>> m : CustomerDetail( rule == ""<br>
>> && age in ("70","75"))<br>
>> then<br>
>> System.out.println("Only senior Age<br>
>> satisfied.");<br>
>><br>
>> m.setRule("11");<br>
>> end<br>
>> This one works but I see these disadvantages:<br>
>> 1)If the rule 1 is satisfied, rule2 is still<br>
>> executed.Similary all the rules in File2.drl.<br>
>> 2)Might impact performance all the 4 rules are called all<br>
>> time.<br>
>> Any suggestions?<br>
>><br>
>> -----Inline Attachment Follows-----<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>
>><br>
><br>
><br>
><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>
><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> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>