[rules-users] accumlator and BigDecimal

mjohansen mjohansen at lazboy.com
Wed Jul 20 12:20:52 EDT 2011


I'm trying to create an accumulator to sum a BigDecimal. Here's what I wrote:

    $upcharge : BigDecimal(  ) 
    from accumulate( GroupUpcharges( row>$gb.row && row<=$gu.row, $value :
upcharge),
                              init( BigDecimal total = BigDecimal.ZERO; ),
                              action( total=total.add($value); ),
                              reverse( total=total.subtract($value); ),
                              result( total ) )

$gb and $gu are set earlier in the WHEN clause.

When I run this, it compiles successfully, but then flows up at run time
with a null pointer exception. What am I doing wrong?

--
View this message in context: http://drools.46999.n3.nabble.com/accumlator-and-BigDecimal-tp3185872p3185872.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list