]
Luca Molteni updated DROOLS-4342:
---------------------------------
Comment: was deleted
(was: It's indeed a type mismatch, as the accumulate over a BigDecimal will return a
Double and in the consequence you try to set it to a BigDecimal field.
Please change this rule like this:
rule "rule"
dialect "mvel"
when
voucher : Voucher( )
sumBilledAmounts : Number( ) from accumulate ( bill : Bill( billedAmount != null ),
sum(bill.billedAmount))
then
modify( voucher ) {
setTotal( BigDecimal.valueOf(sumBilledAmounts.doubleValue()) )
}
end
In this way you get the best data type for accumulating and at the same time you can
decide which type (and precision) to set in the actual field.
)
Using BigDecimal with From Accumulate causes an "Error: argument
type mismatch"
-------------------------------------------------------------------------------
Key: DROOLS-4342
URL:
https://issues.jboss.org/browse/DROOLS-4342
Project: Drools
Issue Type: Bug
Components: kie server
Environment: Red Hat Process Automation Manager (RHPAM) 7.2.0
Reporter: Rodrigo Ribeiro
Assignee: Luca Molteni
Priority: Major
Labels: BigDecimal, DRL, bigdecimal, drl, kie-server, rhpam, rule
Attachments: reproducer-02425606.zip, request.json, testSum.scenario
When written a rule that does a sum using ‘from accumulate’. The rule validates
successfully. However, when trying to test it, is returned a very generic error message:
Error: argument type mismatch.