Is ((DecimalType)$val).toBigDecimal() working correctly, given what you have in $val?
Also, check that count(1) instead of sum(...) produces the expected value. -W On 30/01/2012, Juanker Atina <[email protected]> wrote: > I need your help to put to work an accumulate function. > > So, i will introduce several facts into working memory (StateEvent, which i > declare as event) and i want to accumulate the last five values. > > I have changed a property in drools.default.rulebase.conf > (drools.eventProcessingMode = STREAM) to make the engine works in stream > mode. > > And my rule is: > > > declare StateEvent > @role( event ) > end > > rule "Testing" > > when > $total : Number() from accumulate( > StateEvent(itemName=="Temperatura", $val : newState) over > window:length( 5 ), > sum ( ((DecimalType)$val).toBigDecimal().doubleValue() ) ) > then > #actions > end > > > But it's not working, as the value of $total is 0.0, no matter what i do, > and the rule is firing with every fact in the working memory. > > Any help will be appreciated. > Thanks > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
