[rules-users] are for loops possible in drools

ceemh3 martin_henderson at hotmail.com
Sat Jul 31 11:55:27 EDT 2010



does anybody know if there is a way to do for loops in drools ?.

I am trying to loop through a list of string to see if one of the strings
matches a pattern e.g.

def listOfStrings = ['a','a.b','a.b.c']

for(String s:listOfStrings){
 if(s matches "^a.b.*$"){
 return true 
 }
}

I have written the following rule based on what documentation I could find,
but I dont think the syntax is correct

rule "Matcher"
   when
      TestClass : TestClass(($s matches "^a.b.*$") from listOfStrings,
count($s))
   then
      TestClass.setResponse( "Condition is True !!" );
end

I am finding it hard to find good documentation on the drl language

I would appreciate any help that anybody can give me

-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/are-for-loops-possible-in-drools-tp1011729p1011729.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list