Example FEEL expression from java api

I am trying to execute the example calc-credit-sum.dmn from the blog post: Full Coverage of DMN FEEL 1.2 starting with Camunda BPM 7.13. I am using the embed library DmnEngine. The example
is using the rest api. Is it possible to execute this dmn from the embedded library? I am sending in the “credit_history” as a json string:
VariableMap variables = Variables
.putValue(“credit_history”, creditHistoryJson)

error returned is:

FEEL/SCALA-01008 Error while evaluating expression: failed to evaluate expression ‘{
avg_score: mean(credit_history[type = credit_type].score),
avg_granted_sum: mean(credit_history[type = credit_type].granted_sum)
}’: expected number but found ‘ValError(expect List but found ‘ValString({[{“type”:“personal-loan”, “score”: 505, “granted_sum”: 1554.30}, {“type”:“mortgage”, “score”: 931, “granted_sum”: 600900.43}, {“type”:“mortgage”, “score”: 754, “granted_sum”: 210000.00}, {“type”:“personal-loan”, “score”: 437, “granted_sum”: 1900.44}]})’)’

thanks,

I was able to get this to execute by sending in the credit_history variable as a List instead of a json string (I also tried using the JSON type which also did not work).

1 Like

Hi @mwenczel,

in the example, the JSON variable is transformed by the REST API using the Camunda Spin plugin. In order to use something similar with the DMN engine only, you need to transform the variable manually to a list, or try to integrate Camunda Spin.

Best regards,
Philipp

thanks for the reply. I was able to get it work by using a list. Will investigate the spin plugin…