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

Manish1985 pramanish at gmail.com
Sun Apr 19 23:51:47 EDT 2009


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.




More information about the rules-users mailing list