I am trying to parse a sample decision table, but getting below exception
org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01008 Error while evaluating expression: failed to evaluate expression ‘“Fall”’: no variable found for name ‘cellInput’
I have created dmn file using Camunda Modeler Version 4.12.0 and below is java code to parse the decision.dishTest.dmn (2.7 KB)
VariableMap variables = Variables
DmnEngine dmnEngine = DmnEngineConfiguration.createDefaultDmnEngineConfiguration().buildEngine();
InputStream inputStream = DishDecider.class.getResourceAsStream("/dishTest.dmn");
DmnModelInstance dmnModelInstance = Dmn.readModelFromStream(inputStream);
List decisions = dmnEngine.parseDecisions(dmnModelInstance);
DmnDecision decision = decisions.get(0);
DmnDecisionTableResult result = dmnEngine.evaluateDecisionTable(decision, variables);
// print result
String desiredDish = result.getSingleResult().getSingleEntry();
System.out.println("Dish Decision:\n\tI would recommend to serve: " + desiredDish);
Any help is appriciated.
I looked at your DMN. The parsing itself is fine. But the evaluation of the decision fails.
Clear the field “Input Variable” of the input “Season” and try again. The field “Input Variable” should only be set if you use a different expression language than FEEL, for example, JUEL.
Does this help you?
Hi @Philipp_Ossler ,
Thanks for your reply and your suggestion has worked. However when we create decision table, modeler creates dmn file with decision id = “Decision_0iitlac” and we have to evaluate it like below.
DmnDecisionResult result = dmnEngine.evaluateDecision("Decision_0iitlac",dmnModelInstance,variables);
Is there any way that we can create dmn file with decision id having meaningful name when we create decision table using modeler? We are using modeler version 4.12.0
In modeller (Valid in 4.9, possibly later versions also), ensure you’re at the DRD level, select the decision that you want to change the ID of, and open the Properties Panel. There’s a box marked Id. Change the value to the “meaningful name”
Be aware that this Decision ID must be unique across your instance, so sometimes having a meaningfule name isn’t all that helpful.
There should be (but I can’t find it quickly) a way to get the decision ID from the decision name, but that would then also require that the Name and Version are unique across the system.