[rules-users] from accumulate($somevar)?

ljnelson ljnelson at gmail.com
Fri May 21 13:12:52 EDT 2010


I have a rule that needs to make use of the accumulate() function.

It also needs the value of the first argument to the accumulate() function.

Suppose there are 5 Xs in working memory, each with "count" fields.

I need--in my consequence--access to (a) the list of 5 Xs, and (b) the
result of the accumulate function having worked on them (in my case it's
really just a simple sum, so accumulate(X($count : count), sum($count))).

Naively, I tried this, having a strong and accurate supposition that it
wasn't going to work:

when
  $xs : ArrayList() from collect(X())
  $total : Number() from accumulate($xs, sum(count))

At any rate, I hope that helps convey what I need.  My consequence needs the
list of Xs the accumulate function worked on, as well as the result of the
accumulate function (the Number).  What's the best way to accomplish this?

Thanks in advance,
Laird
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/from-accumulate-somevar-tp834882p834882.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list