Adding the decision logic
Automation Decision Services provides two ways to define the decision logic of node: business rules and decision tables.
Business rules are conditional statements. Basic business rules use an if-then statement to state what action to perform when specific conditions are met. In the following example, the rule outputs a message encouraging people to stay home if there is a storm alert:
if
Weather is storm alert
then
set decision to "It would be wise to stay home. There is a storm alert." ;
More complex business rules can consist of up to four parts: definitions, if, then, and else.
Decision tables allow you to model complex logic. Their tabular layout helps you effectively
document all the possible conditions and results of a decision node. In the following example, the
decision table consists of two inputs, the condition columns Rain forecast and
Temperature, and an output column, Weather advice. It gives a
recommendation on what to bring depending on the weather: a coat, some water, or an umbrella.
| Rain forecast | Temperature | Weather advice | |
|---|---|---|---|
| 0 | 20 | cold | Cold day! Take a coat. |
| 0 | 20 | warm | Warm day! Enjoy. |
| 0 | 20 | hot | Hot day! Grab some water. |
| 20 | 80 | Cloudy day! Think of an umbrella. | |
| 80 | 100 | Rainy day! Take an umbrella. | |
You can use input data and the output of subdecisions while defining the logic of a decision node.