[jboss-user] [Beginners Corner] - First Ever Rule to replace long if then else if bock

ohughes do-not-reply at jboss.com
Tue Sep 2 11:45:01 EDT 2008


Hi all,

I am looking at creating some rule implementations, and want to start with a nice easy example to replace a simple, but long, if then else if block of statements.

To put it simply, 
if a="asdf" && b = "qwer" && c = 1 then
  create me a set of objects
else if a="zxcv" && b = "qwer" && c = 1 then
  create me a different set of objects
etc. etc.
and then a final else block if no matches are found.

How do I map this concept into a drl so that once a rule has matched the required 'when' clause and the required objects are inserted into the WorkingMemory, it doesn't proceed and execute the other rules in the file because they don't need executing as a match has been found?

Thankyou very much in advance for any advice and help offered on this, as I am new to rules, but am unable to work this simple one out.  It probably requires me to think about things differently, but I am unable to find an example which shows me this,

Thanks again,
Osian

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4173766#4173766

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4173766



More information about the jboss-user mailing list