[rules-users] Rule syntax question

Joe12345678990000 Amazander joeamazander at gmail.com
Thu Jun 26 00:41:28 EDT 2008


Greetings,

I have two questions regarding Drools' capability:

1. Does Drools support mathematic operations in the "If" part?

If I use MVEL, can I write something like this:

 $h: Holder($h.account.balance - 1000 > 25)

I know this can be replaced as

 $h: Holder($h.account.balance >1025)

But I need to know if the first expression is valid. I tested and it did not
work for me - am I doing something wrong?

2. Does Drools support function call with parameters?

If I use MVEL, can I write something like this:

...
import com.mytest.util.CommonFunction.myTest;
...

dialect "mvel"
salience 2
when
  $h: Holder(eval(myTest($h.account.balance) >= 0))
then
  $r.account.label = 17;
 update($r);
end

myTest is a static method of CommonFunction.

>From what I read in the doc, "function" is most useful in the then part -
but can I use it in the "if" part? This does not work for me in my test -
did I do anything wrong?

Any help will be appreciated.

Thanks,
Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080626/139c92ed/attachment.html 


More information about the rules-users mailing list