[rules-users] Drools and ArrayList

wendy w.mungovan at yahoo.com
Wed Jul 6 06:08:24 EDT 2011


I think normally setGlobal variables are only used when you want to be able
to call back out to the java code again. (I'm not an expert by any stretch
so please take that with a grain of salt.) So you might be able to just
insert the list.

I'm going to assume the List is really List<NombersUnTypeDefault> if that is
not true please let me know.  

what about something like this?  First is collects all the
NombersUnTypeDefault that match your constraints from list then it counts
them using an accumulate function.

global java.util.List list

rule "Calcul redondance"
   when
       $i: Number() from accumulate($c: NombersUnTypeDefault()
                               from collect(NombersUnTypeDefault($code ==
"AAA", $int == 1) from list)
                               , count($c));
    then
       System.out.println($i);
end

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



More information about the rules-users mailing list