Use JUEL expression to compare input variable value with output field value

I’m trying to compare an input variable value with an output field value.
And I’m doing this in a JUEL expression in the output.

The comparision fails with the following Exception:

Caused by: org.camunda.bpm.dmn.engine.impl.DmnEvaluationException: DMN-01002 Unable to evaluate expression for language 'juel': '${price <= price_lowest ? true : false}'
	at org.camunda.bpm.dmn.engine.impl.DmnEngineLogger.unableToEvaluateExpression(DmnEngineLogger.java:35)
	at org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler.evaluateElExpression(ExpressionEvaluationHandler.java:121)
	at org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler.evaluateExpression(ExpressionEvaluationHandler.java:58)
	at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateOutputEntry(DecisionTableEvaluationHandler.java:236)
	at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateOutputEntries(DecisionTableEvaluationHandler.java:216)
	at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateMatchingRule(DecisionTableEvaluationHandler.java:158)
	at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.setEvaluationOutput(DecisionTableEvaluationHandler.java:150)
	at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateDecisionTable(DecisionTableEvaluationHandler.java:110)
	at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluate(DecisionTableEvaluationHandler.java:77)
	at org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateDecision(DefaultDmnDecisionContext.java:82)
	at org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine.evaluateDecision(DefaultDmnEngine.java:164)
	at org.camunda.bpm.engine.impl.dmn.invocation.DecisionInvocation.invoke(DecisionInvocation.java:53)
	at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:54)
	at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:87)
	at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:59)
	at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor$1.call(DefaultDelegateInterceptor.java:53)
	at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor$1.call(DefaultDelegateInterceptor.java:50)
	at org.camunda.bpm.engine.impl.context.ProcessApplicationClassloaderInterceptor.call(ProcessApplicationClassloaderInterceptor.java:44)
	at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:114)
	at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:125)
	at org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:192)
	at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:50)
	at org.camunda.bpm.engine.impl.util.DecisionEvaluationUtil.invoke(DecisionEvaluationUtil.java:94)
	at org.camunda.bpm.engine.impl.util.DecisionEvaluationUtil.evaluateDecision(DecisionEvaluationUtil.java:83)
	at org.camunda.bpm.engine.impl.dmn.cmd.EvaluateDecisionCmd.doEvaluateDecision(EvaluateDecisionCmd.java:70)
	... 48 more
Caused by: org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'price_lowest'

I need the price_lowest and price_average as output, but I don’t want to have it twice in the table.
I don’t get any errors, when I’m comparing input variable values with input field values (within input fields).

My question is:
Should this generally be possible?
Am I doing something wrong?
Maybe because I’m comparing within an output field?
Or because I’m comparing with an output field value?

Thanks in advance

Steffen

This is a working approach to achieve what I want:

But in my opinion, it doubles the number of lines and doubles the price field.
Guess I’ll do it this way, but my first approach seems way more logical to me.
So I would still appreciate help or hints.

Greetings

Steffen

Nice that you found a solution. I guess what you originally wanted to do is not covered by the DMN spec. If you want to avoid redundancy, you could split the decision into two tables: one for determining the lowest and average price. A second table that takes those as input and provides is_cheapest and then wire them with a DRD. Of course this makes the overall decision model more complex.