The best way to do that would be to write the field constraints for testValue to check for exact ranges. You want, for instance to set percent to 15 if, and only if
Test( testValue >50 && <= 80)
As an alternative, write a function percent(int tv) computing the percent value and do
rule RuleX
when
t : Test( status == 10, $testValue : testValue )
then
t.percent = percent( $testValue );
modify( t );
end
To have an "or" CE in a decision table, simply duplicate the rule (mostly by cell reference, not cut-and-paste) and replace whatever needs to be replaced in the second term of the disjunction.
-W
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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users