Hi,
I am trying to model a use case that involves comparing duration values in a DMN decision table. The table is as given below:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions id="definition_test1" name="definition_test1" namespace="http://camunda.org/schema/1.0/dmn" xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd">
<decision id="decision_test1" name="decision_test1">
<decisionTable hitPolicy="UNIQUE" id="decisionTable_7eab8fb8-b099-4aac-ba2b-260a9acc7067">
<input id="input_724c9611-9a74-461e-8495-e799ee20f8a8" label="duration_span">
<inputExpression id="inputExpression_c6a2175d-d5c7-4510-9274-4ad7e3e1074c" typeRef="YearMonthDuration">
<text>duration_span</text>
</inputExpression>
</input>
<output id="output_e741823b-45cc-4ef5-a780-b8cff92519cc" label="eligible" name="eligible" typeRef="boolean"/>
<rule id="rule_af4c0e9a-e9a7-48dc-b50d-c8306000ccb1">
<inputEntry id="inputEntry_0131f468-3c0a-47f2-9901-e90b989f91e3">
<text><= duration("P12M")</text>
</inputEntry>
<outputEntry id="outputEntry_f6751cd3-f881-446b-bc63-687d10f4ce97">
<text>false</text>
</outputEntry>
</rule>
<rule id="rule_d081dbad-c104-4437-99ac-f769ca061b24">
<inputEntry id="inputEntry_402207b3-f457-4884-9a30-f98a4bdbd292">
<text>> duration("P12M")</text>
</inputEntry>
<outputEntry id="outputEntry_049ac977-5115-474e-a6c8-1ac0a1d1b6cb">
<text>true</text>
</outputEntry>
</rule>
</decisionTable>
</decision>
</definitions>
When I try to evaluate with input for duration_span
as P1Y or P1Y1M I get the following exception:
Oct 26, 2021 6:55:17 PM org.camunda.commons.logging.BaseLogger logWarn
WARNING: DMN-01006 Unsupported type 'YearMonthDuration' for clause. Values of this clause will not transform into another type.
Exception in thread "main" org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01008 Error while evaluating expression: failed to evaluate expression '<= duration("P12M")': ValString("P1Y") can not be compared to ValYearMonthDuration(P1Y)
at org.camunda.bpm.dmn.feel.impl.scala.ScalaFeelLogger.evaluationException(ScalaFeelLogger.java:77)
at org.camunda.bpm.dmn.feel.impl.scala.ScalaFeelEngine.evaluateSimpleUnaryTests(ScalaFeelEngine.java:115)
at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateFeelSimpleUnaryTests(DecisionTableEvaluationHandler.java:246)
at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateInputEntry(DecisionTableEvaluationHandler.java:203)
at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.isConditionApplicable(DecisionTableEvaluationHandler.java:145)
at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateInputForAvailableRules(DecisionTableEvaluationHandler.java:137)
at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateDecisionTable(DecisionTableEvaluationHandler.java:111)
at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluate(DecisionTableEvaluationHandler.java:81)
at org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateDecision(DefaultDmnDecisionContext.java:85)
at org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine.evaluateDecisionTable(DefaultDmnEngine.java:115)
at org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine.evaluateDecisionTable(DefaultDmnEngine.java:105)
Couple of questions:
- What should the data type be used for durations in Unary expression ?
- Is the comparsion between 2 duration supported e.g. P1Y1M > P1Y.