Thanks for the response @Philipp_Ossler !!
Here is the DMN which has the actual input value (packages
) in the FEEL filter expression. This works:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions id="definition_countTest1" name="definition_countTest1" namespace="http://camunda.org/schema/1.0/dmn" xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd">
<decision id="decision_countTest1" name="decision_countTest1">
<decisionTable hitPolicy="UNIQUE" id="decisionTable_84113164-d700-4946-9e84-140f0dc76221">
<input id="input_ecab2024-cae1-4c5d-8fd3-ce40d045e58f" label="packages">
<inputExpression id="inputExpression_34d159d9-f8ec-4f76-9ebd-3e405b84880c" typeRef="string">
<text>packages</text>
</inputExpression>
</input>
<input id="input_5cbbe120-aa01-4208-8318-421f743f1277" label="term">
<inputExpression id="inputExpression_9bd3f966-1cf9-4ab4-94e3-56e2d92bc468" typeRef="long">
<text>term</text>
</inputExpression>
</input>
<output id="output_c10cf44c-89de-421e-8408-75eb625630ec" label="bundle" name="bundle" typeRef="string"/>
<rule id="rule_fd8f89da-5a2e-4e50-a3b7-cb4d5eb6da6b">
<inputEntry id="inputEntry_5bbeb617-99da-4432-b3a6-3932549217d7">
<text>count(packages[list contains(["P1","P2","P3","P4"], item)]) = 1</text>
</inputEntry>
<inputEntry id="inputEntry_6028eab6-df35-406a-bc35-091c30cd9a0f">
<text>>=24</text>
</inputEntry>
<outputEntry id="outputEntry_ad0e5aee-4e84-4ed5-a9c0-d81f7b2b620d">
<text>"B1"</text>
</outputEntry>
</rule>
<rule id="rule_eced9637-2add-48a9-bade-74168146f638">
<inputEntry id="inputEntry_f99be31c-c4c1-43d0-b433-d35edb215ca5">
<text>count(packages[list contains(["P1","P2","P3","P4"], item)]) = 2</text>
</inputEntry>
<inputEntry id="inputEntry_1698b701-58d7-4543-96f6-674ecebf89aa">
<text>>=24</text>
</inputEntry>
<outputEntry id="outputEntry_0dad1582-0b56-4145-9001-3d8ffd4e897b">
<text>"B2"</text>
</outputEntry>
</rule>
</decisionTable>
</decision>
</definitions>
But if I change the expression to count(?[list contains(["P1","P2","P3","P4"], item)]) = 1
, then I get a runtime error.
Exception in thread "main" org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01008 Error while evaluating expression: failed to evaluate expression 'count(?[list contains(["P1","P2","P3","P4"], item)]) = 1': expect List but found 'ValString([P1, P2])'
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)
Here is the corresponding DMN (where ? is used):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions id="definition_countTest1" name="definition_countTest1" namespace="http://camunda.org/schema/1.0/dmn" xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd">
<decision id="decision_countTest1" name="decision_countTest1">
<decisionTable hitPolicy="UNIQUE" id="decisionTable_c6875a44-7492-4e5b-868c-9d58dd9d18e4">
<input id="input_eb2c3e84-9144-4540-8d97-2a6bdaa35f81" label="packages">
<inputExpression id="inputExpression_87f0d243-7608-4555-be4d-2f347f6b95d8" typeRef="string">
<text>packages</text>
</inputExpression>
</input>
<input id="input_a31351b0-8578-4abc-bf38-97b442ee29cd" label="term">
<inputExpression id="inputExpression_a26994c4-64f4-4402-bbc1-b710e0297371" typeRef="long">
<text>term</text>
</inputExpression>
</input>
<output id="output_6c2a010d-c633-4da6-b384-32aee7e720f1" label="bundle" name="bundle" typeRef="string"/>
<rule id="rule_f8b9b777-cd24-44e7-a518-20a6bb5cfacd">
<inputEntry id="inputEntry_7bc80029-dfc4-484c-bb2d-d5444bb9df60">
<text>count(?[list contains(["P1","P2","P3","P4"], item)]) = 1</text>
</inputEntry>
<inputEntry id="inputEntry_1b8bcd0f-f470-40c7-b92b-5e5e83c5a32f">
<text>>=24</text>
</inputEntry>
<outputEntry id="outputEntry_fcc0e9cf-2329-4360-b31e-8e4d7f6b5219">
<text>"B1"</text>
</outputEntry>
</rule>
<rule id="rule_993194bb-a7aa-48e9-a149-4741f8856752">
<inputEntry id="inputEntry_1ea691a9-c87f-49ae-bab7-41312e9605ef">
<text>count(?[list contains(["P1","P2","P3","P4"], item)]) = 2</text>
</inputEntry>
<inputEntry id="inputEntry_b9885aba-2ca2-48d7-8fdc-4b284ddb6c52">
<text>>=24</text>
</inputEntry>
<outputEntry id="outputEntry_05bcd623-5891-4178-9fb5-9f85f9546b7c">
<text>"B2"</text>
</outputEntry>
</rule>
</decisionTable>
</decision>
</definitions>