I am trying to sum the contents of an array in my DMN.
The ruleset:
stpRules.dmn (3.6 KB)
The input, stored in parameter fraudData
:
{
"customersName": "Test One",
"customersNameCinBin": "1111111111",
"customersAccountNumber": "11111111",
"customersSortCode": "111111",
"paymentDetails": [
{
"transactionDate": "2024-04-21T18:25:43-01:11",
"transactionAmount": 250.00,
"transactionType": "POS",
"maskedPAN": "************1111",
"paymentStatus": "Pending"
}
],
"pocDataPoints": {
"isAnIncident": "false",
"existingCasesInLastTwelveMonths": "0"
}
}
In the DMN I have a literal function trying to determine the total of transactionAmount
. Here is the function:
sum(fraudData.paymentDetails.transactionAmount)
The statement does not return a result, this is the main issue
This does not resolve correctly, even though the following resolves in the DMN testing tool: Try out and learn DMN FEEL - FEEL Playground
I assume I am doing something wrong with the variable fraudData
. So in my DMN STP rules, I added some debug info. Here is the output when the rule is run in Camunda:
{
"stpEligible": true,
"tryingSumDirectly": null,
"fraudData_paymentDetailsTransaction_amount": [
"250.00"
],
"outputFromCalculateTotal": null,
"theOriginalParamPassedIn": {
"customersName": "Test One",
"customersNameCinBin": "1111111111",
"customersAccountNumber": "11111111",
"paymentDetails": [
{
"paymentStatus": "Pending",
"transactionType": "POS",
"transactionAmount": "250.00",
"transactionDate": "2024-04-21T18:25:43-01:11",
"maskedPAN": "************1111"
}
],
"customersSortCode": "111111",
"pocDataPoints": {
"existingCasesInLastTwelveMonths": "0",
"incident": false
}
},
"ruleMatched": 1
}
- Output from
tryingSumDirectly
is running the actual sum formula - result empty - Output from
fraudData_paymentDetailsTransaction_amount
shows the transactionAmount resolves into an array, though it is a String even though my input is not String? - Output
theOriginalParamPassedIn
shows thatfraudData
resolves successfully
Any help will be appreciated.
Pieter