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.
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
This illustrates very nicely the duality (by de Morgan's laws) between
forall and negated existence.
As for efficiency: repeated evaluation of large lists where the elements
aren't facts /may/
slow you down - whether this is a problem depends on other factors.
--
View this message in context:
http://drools.46999.n3.nabble.com/Loop-Drools-on-Multi-Element-tp3761638p...
Sent from the Drools: User forum mailing list archive at
Nabble.com.