You might be looking for accumulate or collect patterns. You will find all
the information you need in the manual.
Best,
El jul 30, 2010 11:22 a.m., "Dinesh kumar" <dinp87(a)gmail.com> escribió:
Hi,
I am facing problems in iterating a list in guvnor.
I tried the following code and it worked.
import java.util.ArrayList;
rule createValidationReport
dialect 'java'
when
ClaimRegistration($ailmentList : ailmentListFromScreen)
then
for(String ailment : (ArrayList<String>) $ailmentList){
System.out.println("ailment "+ailment);
}
System.out.println("then");
end
But my requirement is to iterate the list in the when block and process
something based on the data in the list.
It should be something like
import java.util.ArrayList;
rule createValidationReport
dialect 'java'
when
ClaimRegistration($ailmentList : ailmentListFromScreen)
for(String ailment : (ArrayList<String>) $ailmentList){
System.out.println("ailment "+ailment);
// My condition needs to be evaluated here
}
then
System.out.println("then");
end
Need help on this issue. Is this possible in Drools?
kindly advice.
Regards,
Dinesh
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/How-to-Iterate-list-i...
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