Task 3: Adding nodes
You add two nodes for the weather to the decision model. When you run the model, it produces a greeting and weather advice.
Step 1: Adding nodes to the decision model
- Click My Service to open your decision service. Then, click My Model to open your decision model.
- Click Add decision to create a decision node:

- In the right panel, change the Node name field of the new node to Weather advice. Leave string as the output type.
- Hover over the error icon
to see its message:
The node 'Weather advice' must have one or more links to or from other nodes.
The message is also shown in the Error report tab. Each node must be connected to at least one other node.
- Hover over the Weather advice node, and click the Add
input icon:

- In the right panel, change the Node name field to Rain forecast.
- Expand the Output type field, and select integer from the menu.
- Hover over the Weather advice node, and click the Connect to
another node icon:

- Drag the line to the Daily advice node, and click the node to complete
the connection. Now, data flows from the Rain forecast node to the
Weather advice node, and decisions flow from the Weather
advice node to the Daily advice node:

Step 2: Adding a decision table
A decision table groups business rules that share the same logic but have different values. Each row in a decision table represents a complete business rule. The decision table has separate columns for condition values and action values. When data enters a decision table, it is matched to values in condition columns and the associated action value is used in the output of the decision table (see Working with decision tables).
- Select the Weather advice node.
- Open the Logic tab, click Create rule artifact
, and select Decision table.
- Enter weather table in the Name field of the new table, select Rain forecast for the condition columns, and then click Create.
- Enter the following values in the decision table. To add a value to a cell, double-click the
cell. Alternatively, you can copy the content of the table below and paste it directly into the
decision table.Tip: You can resize the decision table by dragging its borders.
Rain forecast Weather advice min max 0 20 Nice day. Enjoy the weather! 20 80 Risk of rain. Might need an umbrella. 80 100 Rainy day. Take an umbrella. - Right-click
100in the decision table, and select Change operator. By default, the operator is set to [..[. Select [..] to change the operator. Now, the value is included in the conditions. - Click Back to the diagram to close the editor. Now, the model outputs a greeting, and advice from the weather decision table.
- Select the Daily advice node.
- In the Logic tab, open the Advice rule and make
the following changes:
if Name is defined then set decision to `Hello { 'Name' }! { 'Weather advice' }` ;Tip: As withHello, add a space after!to leave a gap before the weather advice in the output.
Step 3: Running the decision model
- Open the Run tab.
- Add the following test data:
Again, the form uses the JSON representation of the name of an input node. Here, Name and Rain forecast become name and rainForecast. For more information, see Modeling data.
- name: Robin
- rainForecast: 87
- Click Run. You get the following message:
Hello Robin! Rainy day. Take an umbrella.
- Delete the test data for the next task.