Looks like 5 rules with a global flag might work:

global boolean flag = false;

rule "name1"
when
 (condition1 == true )
 (flag == false)
then
 consequence1();
 flag = true;
end

...

rule "name5"
when
 (condition5 == true )
 (flag == false)
then
 consequence5();
 flag = true;
end

Does that work for you?

Vishy [6/15/2009 11:06 PM] wrote:
Hi All,

I am new to drools...and am trying to figure out as to how I can
represent the following logic in a DRL file.

if (condition1) {

  if (condition2) {

  } else if (condition3) {

  } else if (condition 4) {

  } else if (condition 5) {

  }

}

In DSL, a typical rule is represented as follows:

rule "name"

when
  condition is true
then
  consequence

end

How can I represent the above mentioned if - else logic in DSL? Or is
it not possible?

If it is not, can you please suggest any alternative?

Thanks much!!
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to