[rules-users] accumulate function

Wendy Mungovan w.mungovan at yahoo.com
Wed Sep 21 13:05:49 EDT 2011


The total of just one SegmentsGroup8....

What about something like this:


 $allGroups: ArrayList(  )
    from accumulate( $seg: SegmentsGroup8(  ),
      init( ArrayList controlTotals = new ArrayList(); ),
      action( controlTotals.add($seg.getCnt()); ),
      reverse( controlTotals.remove($seg.getCnt()); ),
      result( controlTotals)
    )

$sum: Number() from accumulate($cntTotal: ControlTotal() from $allGroups, sum($cntTotal.getC6066()))


This might also work .. but I'm not sure


$allGroups: List() from collect(SegmentsGroup8())
$sum: Number() from accumulate($cntTotal: ControlTotal() from $allGroups.getCnt(), sum($cntTotal.getC6066()))





________________________________
From: pamerida <elpamm at hotmail.com>
To: rules-users at lists.jboss.org
Sent: Wednesday, September 21, 2011 11:43 AM
Subject: Re: [rules-users] accumulate function

Thanks for your reply Wendy, but I have a question, would that code get me
the sum of all the SegmentsGroup8?, or will that give me the sum of each
individual SegmentGroup8??, cause what I need is the sum of all the
controltotal of all the segmentGroup8 asserted into the WM... thanks so much
for your help...

--
View this message in context: http://drools.46999.n3.nabble.com/accumulate-function-tp3353507p3355812.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110921/be520548/attachment.html 


More information about the rules-users mailing list