Input - 图1

A decision table can have one or more inputs, also called input clauses. Aninput clause defines the id, label, expression and type of a decision tableinput.

An input clause is represented by an input element inside a decisionTableXML element.

  1. <definitions xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd" id="definitions" name="definitions" namespace="http://camunda.org/schema/1.0/dmn">
  2. <decision id="dish" name="Dish">
  3. <decisionTable id="decisionTable">
  4. <input id="input1" label="Season">
  5. <inputExpression id="inputExpression1" typeRef="string">
  6. <text>season</text>
  7. </inputExpression>
  8. </input>
  9. <!-- ... -->
  10. </decisionTable>
  11. </decision>
  12. </definitions>

Input Id

The input id is a unique identifier of the decision table input. It is used bythe Camunda BPMN platform to reference the input in the history of evaluateddecisions. Therefore, it is required by the Camunda DMN engine. It is set asthe id attribute of the input XML element.

  1. <input id="input1" label="Season">
  2. <inputExpression id="inputExpression1" typeRef="string">
  3. <text>season</text>
  4. </inputExpression>
  5. </input>

Input Label

Input - 图2

An input label is a short description of the input. It is set on the inputXML element in the label attribute. Note that the label is not required butrecommended, since it helps to understand the decision.

  1. <input id="input1" label="Season">
  2. <inputExpression id="inputExpression1" typeRef="string">
  3. <text>season</text>
  4. </inputExpression>
  5. </input>

Input Expression

Input - 图3

An input expression specifies how the value of the input clause is generated.It is an expression which will be evaluated by the DMN engine. It is usuallysimple and references a variable which is available during the evaluation. Theexpression is set inside a text element that is a child of theinputExpression XML element.

  1. <input id="input1" label="Season">
  2. <inputExpression id="inputExpression1" typeRef="string">
  3. <text>season</text>
  4. </inputExpression>
  5. </input>

Input Type Definition

Input - 图4

The type of the input clause can be specified by the typeRef attribute on theinputExpression XML element. After the input expression is evaluated by theDMN engine, it converts the result to the specified type. The supported typesare listed in the User Guide.

  1. <input id="input1" label="Season">
  2. <inputExpression id="inputExpression1" typeRef="string">
  3. <text>season</text>
  4. </inputExpression>
  5. </input>

Note that the type is not required but recommended, since it helps to understandthe possible input values and provides a type safety to be aware of unexpectedinput values.

Input Expression Language

The expression language of the input expression can be specified by theexpressionLanguage attribute on the inputExpression XML element. Thesupported expression languages are listed in the User Guide.

  1. <input id="input1" label="Season">
  2. <inputExpression id="inputExpression1" typeRef="string" expressionLanguage="groovy">
  3. <text>season</text>
  4. </inputExpression>
  5. </input>

If no expression language is set then the global expressionlanguage, which is set on the definitions XML element, is used.

  1. <definitions id="definitions"
  2. name="definitions"
  3. xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd"
  4. expressionLanguage="groovy"
  5. namespace="http://camunda.org/schema/1.0/dmn">
  6. <!-- ... -->
  7. </definitions>

In case no global expression language is set, the default expression languageis used instead. The default expression language for input expressions is JUEL.Please refer to the User Guide to read more about expressionlanguages.

Input Variable Name

When the input expression is evaluated then the return value is stored in a variable.The name of the variable can be specified by the camunda:inputVariableextension attribute on the input element. By default, thename is cellInput.

To use the attribute you have to define the Camunda DMN namespacexmlns:camunda="http://camunda.org/schema/1.0/dmn in the XML.

  1. <definitions id="definitions"
  2. name="definitions"
  3. xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd"
  4. xmlns:camunda="http://camunda.org/schema/1.0/dmn"
  5. namespace="http://camunda.org/schema/1.0/dmn">
  6. <decision id="dish" name="Dish">
  7. <decisionTable id="decisionTable">
  8. <input id="input1"
  9. label="Season"
  10. camunda:inputVariable="currentSeason">
  11. <!-- ... -->
  12. </input>
  13. <!-- ... -->
  14. </decisionTable>
  15. </decision>
  16. </definitions>

The variable can be used in an expression of an input entry. For example, theJUEL expression currentSeason != "Fall" checks if the season input is not"Fall".

原文: https://docs.camunda.org/manual/7.9/reference/dmn11/decision-table/input/