This is how to do it - although it&#39;s not recommended to use globals in rule conditions. (For one thing: the list must be complete before you call fireAllRules().)<br><br>global List list<br><br>rule &quot;count from global List - but don&#39;t do it&quot;<br>
when<br>    Number( $i: intValue ) from accumulate( Person( age &gt; 20 ) from list, count(1) )<br>then<br>    System.out.println( $i + &quot; Persons&quot; );<br>end<br><br>-W<br><br><br><div class="gmail_quote">On 6 July 2011 12:08, wendy <span dir="ltr">&lt;<a href="mailto:w.mungovan@yahoo.com">w.mungovan@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I think normally setGlobal variables are only used when you want to be able<br>
to call back out to the java code again. (I&#39;m not an expert by any stretch<br>
so please take that with a grain of salt.) So you might be able to just<br>
insert the list.<br>
<br>
I&#39;m going to assume the List is really List&lt;NombersUnTypeDefault&gt; if that is<br>
not true please let me know.<br>
<br>
what about something like this?  First is collects all the<br>
NombersUnTypeDefault that match your constraints from list then it counts<br>
them using an accumulate function.<br>
<br>
global java.util.List list<br>
<br>
rule &quot;Calcul redondance&quot;<br>
   when<br>
       $i: Number() from accumulate($c: NombersUnTypeDefault()<br>
                               from collect(NombersUnTypeDefault($code ==<br>
&quot;AAA&quot;, $int == 1) from list)<br>
                               , count($c));<br>
    then<br>
       System.out.println($i);<br>
end<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Drools-and-ArrayList-tp3140821p3144161.html" target="_blank">http://drools.46999.n3.nabble.com/Drools-and-ArrayList-tp3140821p3144161.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>