Spin + FEEL setup

Hi All,

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:

		<dependency>
			<groupId>org.camunda.feel</groupId>
			<artifactId>feel-engine</artifactId>
			<version>1.12.4</version>
		</dependency>		
		<dependency>
			<groupId>org.camunda.bpm.extension.feel.scala</groupId>
			<artifactId>feel-engine-plugin</artifactId>
			<version>1.10.1</version>
		</dependency>

Thanks,
Hakan

Hello @raft,
The quotes are not needed, have you tried without them?

Best, McAlm

1 Like

Hi @McAlm,

I guess in this case they are needed, because the entry is a number. Kinda special character.

But yes, I tried with alphanumeric entry names and without the quotes. Same result.

Best

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>();

	map.put(Integer.valueOf(7401), Integer.valueOf(1407));
	map.put("Palim", "Palam");

	SpinJsonNode json = JSON(map);
	execution.setVariable("kpis", json);
	execution.setVariable("kpis2", Spin.JSON(map).mapTo(Map.class));

Hi @McAlm,

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.

Thanks

The Variables inspection is an enterprise feature. It is not contained in the CommunityEdition.

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.

@Philipp_Ossler: Do you have an idea here?

Using Camunda 7.14, it works for me :slight_smile:

I can start a process that calls the business rule task. I use the REST API with the following variables:

{
 "variables":{
   "x" : {
     "value" : "{\"10\":\"x\"}",
     "type": "json"}
 },
 "withVariablesInReturn": true
}