<p>
Using forall isn't so complicated. You can use the simplified form, where the
condition to be satisfied is written in the pattern selecting the domain.
<pre>
rule setPriority
when
$order: OrderType( priority != "high" )
forall ( OrderLineType( quantity > 2 ) from $order.lineItem )
then
modify( $order ){ setPriority( "high" ) }
System.out.println( "set to high" );
end
</pre>
</p>
<p>
This illustrates very nicely the duality (by de Morgan's laws) between forall and negated existence.
</p>
<p>
As for efficiency: repeated evaluation of large lists where the elements aren't facts <i>may</i>
slow you down - whether this is a problem depends on other factors.
</p>
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://drools.46999.n3.nabble.com/Loop-Drools-on-Multi-Element-tp3761638p3765879.html">Re: Loop Drools on Multi Element</a><br/>
Sent from the <a href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html">Drools: User forum mailing list archive</a> at Nabble.com.<br/>