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@hotmail.com>
To: rules-users@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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users