Try:
when
TestClass( $list : listOfStrings )
Number( $count : intValue ) from accumulate(
String( this matches "^a.b.*$" ) from $list,
count(1) )
then
// $count has number of matching strings
end
[]s
Edson
2010/7/31 ceemh3 <martin_henderson(a)hotmail.com>
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-possibl...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com