With Drools Rules "mvel" how to iterate over a collection and verify a property for each object in the collection?
Drools rule iterate collections and verify property
13.4k views Asked by joshjdevl At
2
There are 2 answers
2
On
Here's the code for going over the collection of Interests inside a Person object and checking if one of them is contains an interestName field "Running":
rule "likes running?"
when
$p : Person()
$inter : Interest ( interestName == "Running" ) from $p.interests
then
System.out.println("I like running too.");
end
Look for the
forall
keyword in the reference manual (follow documentation on the drools page).