Drools rule using accumulate

718 Views Asked by At

Hello I it is my first time involved in drools project. I have created some simple rules that work fine, however I have trouble with more complex rules that use the accumulate function. Below I have this rule.

rule "1"
no-loop
when 
    $msg : Declaration(header.totalGrossMassMeasure != null, 
    header.totalGrossMassMeasure.compareTo(BigDecimal.ZERO) > 0 )
     result : ValidationResult()
    $netValue : Number() from accumulate (
    GoodsItemsType($net : netNetWeightMeasure),
    sum($net.doubleValue())
    )
eval($netValue.doubleValue() > ($msg.getHeader().getTotalGrossMassMeasure().doubleValue() + (0.45 * $msg.getGoodsItems().size())))
then
RulesValidationError error = new RulesValidationError();
error.setErrorType(ErrorType.INCORECT_VALUE);
result.getErrorsList().add(error);
end

the concept is to sum the net value from a list of goodsItemType object and compare the sum to the total gross mass measure multiplied by one buffer number. The problem is I have been trying last couple of days not being able to fire the rule with anything. Could someone please help me?

0

There are 0 best solutions below