I have a DMN utilizing FEEL and have expressions like:
kpis.`1708` = 0
I use this DMN inside a BPMN as a Business Rule Task.
When I provide the input to DMN as a Java Map, it all works okay. However when the input is Spin JSON, it fails saying context contains no entry with key ‘1708’.
execution.setVariable('kpis', map); // -> this works
execution.setVariable('kpis', Spin.JSON(map)); // -> this fails
I’m pretty sure the Spin has the entries, since I print it to console. And I even converted it back to Map, which also works fine.
execution.setVariable('kpis', Spin.JSON(map).mapTo(Map.class)); // -> this works too
Any clues?
This is running inside spring-boot-starter. Following are FEEL related dependencies:
Whenever you jsonify your objects the keys will be always represented as String as this is defined by JSON itself.
Map<Object, Object> map = new HashMap<Object, Object>();
True, JSON keys are always strings, but this is not related to JSON but FEEL. kpis.1708 is not a valid FEEL expression. As mentioned in feel-scala documents, if there are special characters in keys they should be wrapped in backquotes.
Anyway, this is not working with alphanumerical keys and without backquotes either. I tried it again. Any other suggestions?
Btw, how do you enable that Variables section in the Camunda cockpit? it doesnt show up in my spring boot app.
I’m seeing the problem, have the same here. The FEEL expression actually is correct, that is the way how a context is queried.The problem seems to be related to the jsonification of the Map.