I need your help to put to work an accumulate function.<br><br>So, i will introduce several facts into working memory (StateEvent, which i declare as event) and i want to accumulate the last five values.<br><br>I have changed a property in drools.default.rulebase.conf (drools.eventProcessingMode = STREAM) to make the engine works in stream mode.<br>
<br>And my rule is:<br><br><br>declare StateEvent<br>    @role( event )<br>end<br><br>rule &quot;Testing&quot;<br><br>when<br>    $total : Number() from accumulate(<br>        StateEvent(itemName==&quot;Temperatura&quot;, $val : newState) over window:length( 5 ),<br>
        sum ( ((DecimalType)$val).toBigDecimal().doubleValue() ) )<br>then<br>    #actions<br>end<br><br><br>But it&#39;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.<br>
<br>Any help will be appreciated.<br>Thanks<br>