[jboss-jira] [JBoss JIRA] (DROOLS-4342) Using BigDecimal with From Accumulate causes an "Error: argument type mismatch"
Luca Molteni (Jira)
issues at jboss.org
Fri Jul 19 04:38:04 EDT 2019
[ https://issues.jboss.org/browse/DROOLS-4342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
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.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the jboss-jira
mailing list