Create a DMN Decision Table
In this section you learn how to create your first DMN decision table with the Camunda Modeler. The table will contain the decision logic about the desired dish for a given season and guest count.
Now start up the Camunda Modeler.
Create a new Decision Table
Create a new DMN table by clicking File > New File > DMN Table.
Start with the Table Header
First, click on “Enter Advanced Mode” to see and edit the technical properties.
Start by setting the name of the decision. Click on the top left field and type “Dish” as the name of the decision.
Next, click on the field below and replace “decision” by “dish” to set the technical id of the decision which is used to reference the decision inside the process application.
Configure the Input Expression and the Output Name
Assuming that the input value for “Season” is provided by a variable with name “season”, the input expression should be “season”.
Click on the field under “Season”. In the dialog that pops up, set “season” as expression and close it.
Next, click on the field under “Dish” and set “desiredDish” as output name.
Configure the Type of the Input and Output
Assuming that the input value for “Season” is provided as String, the type of the input value should be “string”.
Click on the field under the input expression “season”. Open the combo box and choose the type “string” in the dialog that pops up.
Same for the output type, click on the field under the output name “desiredDish” and choose “string” as type.
Now, add the first rule that specifies that the desired dish for season “Fall” is “Spareribs”.
Click on the “+” button at the bottom of the table. In the row that was added, type “Fall” in the input column and “Spareribs” in the output column.
“Spareribs” is the conclusion (i.e., output entry) of the rule. It is a simple expression in JUEL and returns the String “Spareribs”.
Next, add a second input “How many guests” with the input expression “guestCount” and type “integer”. Fill the table with additional rules for the remaining seasons.
Configure the Hit Policy
Set the hit policy to “UNIQUE”, which specifies that only one rule can match. Verify that the decision table contains only one rule that can match the inputs.
Click on the field under the id of the decision. In the dialog that pops up, open the combo box and choose the hit policy “UNIQUE”.
Default Hit Policy
The default hit policy is “UNIQUE” which is displayed as “U” in the table. If your rules are disjunct so only one rule can match then you don’t need to change the hit policy.
Save the Decision Table
When you are done, save your changes by clicking File > Save File As... In the dialogue that pops up, navigate to the application project directory (by default this is in your Eclipse workspace path). In the project directory, place the model in the
Return to Eclipse. Right-click the project folder and click Refresh. This synchronizes the new DMN file with Eclipse.
For Eclipse to automatically sychronize the workspace with the filesystem, consider configuring auto-sync in eclipse.
Catch up: Get the Sources of Step-3.
You can checkout the current state from the GitHub repository.
If you have not cloned the repository yet, please execute the following command:
git clone https://github.com/camunda/camunda-get-started-dmn.git
To checkout the current state of the process application please execute the following command:
git checkout -f Step-3Or download as archive from here.