[rules-users] Drools and ArrayList

wendy w.mungovan at yahoo.com
Tue Jul 5 13:23:46 EDT 2011


Have you tried using the accumulate function?

//taken from the link below and modified a bit to use count.. (it is
untested)

rule "Count the number of items in the order"
when
    $order : Order()
    $total : Number( ) 
             from accumulate( OrderItem( order == $order),  count( ) )
then
 System.out.println("There are "+$total+ " number of items in the order");

end


http://docs.redhat.com/docs/en-US/JBoss_Enterprise_SOA_Platform/4.3/html/JBoss_Rules_Reference_Guide/ch05s05s02s10.html 

--
View this message in context: http://drools.46999.n3.nabble.com/Drools-and-ArrayList-tp3140821p3141665.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list