[rules-users] I want only first rule to be executed even more than one rule are fulfilling the LHS

Edson Tirelli tirelli at post.com
Mon Apr 20 08:26:49 EDT 2009


   Take a look at the manual on "activation-group"s. They allow you to do
that.

   Also, you can call fireAllRules(1) to fire only one rule, in case your
whole rulebase is like that.

   []s
    Edson

2009/4/19 Manish1985 <pramanish at gmail.com>

>
> Hi All,
>
> Assume that following is the case,
>
> rule "Rule1"
>
>        when
>                t:Test(status==10)
>                Test(testValue > 90)
>
>        then
>                t.percent=5;
>                          modify(t);
>
> end
>
>
> rule "Rule2"
>
>        when
>                t:Test(status==10)
>                Test(testValue> 80)
>
>        then
>                t.percent=10;
>                          modify(t);
>
> end
> rule "Rule3"
>        when
>                t:Test(status==10)
>                Test(testValue  > 50)
>        then
>                t.percent=15;
>                          modify(t);
>        end
>
> Here, based on each condition i will assign percentage value.
> Assume that testValue is 100 and status is 10 so it will be evaluated true
> for each rule
> but i dont want that. i want Rule1 to be evaluated and then it should stop
> executing other rules other wise percetage value will be different from
> what
> i want.
> (15 instead of 5).
>
> I can do this by adding one more condition in every rule like
> Test(percent==0)
>
> and initially i will intialize Test.percent by zero so only first Rule will
> be evaluated/executed.
>
> But is there any other way apart from these?
>
> One more thing is that in decision table i want to add OR between two
> conditions.
> How can i do that? please give me example for doing that.
>
> Thanks a lot in advance.
>
> Regards,
> Manish
>
> --
> View this message in context:
> http://www.nabble.com/I-want-only-first-rule-to-be-executed-even-more-than-one-rule-are-fulfilling-the-LHS-tp23080560p23080560.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090420/38f96133/attachment.html 


More information about the rules-users mailing list