I don&#39;t know If I understood well, but did you try this?<div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">when<br> $xs : ArrayList() from collect(X())<br>

 $total : Number() from accumulate(X($c: count), sum($c))</span></div><div><br></div><div>The accumulate will iterate over all the X and calculate the sum.</div><div><br></div><div>Best,<br><br><div class="gmail_quote">On Fri, May 21, 2010 at 2:12 PM, ljnelson <span dir="ltr">&lt;<a href="mailto:ljnelson@gmail.com">ljnelson@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
I have a rule that needs to make use of the accumulate() function.<br>
<br>
It also needs the value of the first argument to the accumulate() function.<br>
<br>
Suppose there are 5 Xs in working memory, each with &quot;count&quot; fields.<br>
<br>
I need--in my consequence--access to (a) the list of 5 Xs, and (b) the<br>
result of the accumulate function having worked on them (in my case it&#39;s<br>
really just a simple sum, so accumulate(X($count : count), sum($count))).<br>
<br>
Naively, I tried this, having a strong and accurate supposition that it<br>
wasn&#39;t going to work:<br>
<br>
when<br>
  $xs : ArrayList() from collect(X())<br>
  $total : Number() from accumulate($xs, sum(count))<br>
<br>
At any rate, I hope that helps convey what I need.  My consequence needs the<br>
list of Xs the accumulate function worked on, as well as the result of the<br>
accumulate function (the Number).  What&#39;s the best way to accomplish this?<br>
<br>
Thanks in advance,<br>
Laird<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/from-accumulate-somevar-tp834882p834882.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/from-accumulate-somevar-tp834882p834882.html</a><br>


Sent from the Drools - User 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><br clear="all"><br>-- <br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>
</div>