Creating Case Statements

A Switch node is used to select one path of execution based on the evaluation of an expression specified on a condition node. A Switch node contains one condition node, one or more case paths, and one default path. At run time, the expression on the condition node is executed, and the resulting value is compared to the values associated with each case path. Execution continues with activities inside the first case path that contains a matching value (case paths are evaluated left-to-right in the Switch node). When no conditions are met, activities defined on the default path are executed.

This section describes how to add a Switch node to your business process, define conditions, and define activities for the alternative paths of execution in the Switch node. It contains the following topics:

Comparing Decision Nodes and Switch Nodes

How does a Decision node differ from a Switch node?

A Decision node can include one or more conditions to be evaluated at run time. For a scenario in which a Decision node is defined, the business process evaluates the conditions (one on each path) sequentially, and executes the path for the first condition that evaluates as true. (Conditions are evaluated left-to-right in the Decision node.) In other words, if the first condition evaluates to false, the second condition is evaluated. If the second condition evaluates to false, the next condition is evaluated, and so on. The activities defined on the default path are executed if no conditions are met.

A Switch node includes a single condition. For a scenario in which a Switch node is defined, the business process evaluates an expression specified on a single condition node and selects one path of execution based on the evaluation of that expression. The possible paths of execution in a Switch node include one or more case paths, and one default path. Execution continues with activities inside the first case path that contains a matching value. (Case paths are evaluated left-to-right in the Switch node.) If the value resulting from the evaluation of the condition expression does not match any of the case paths, then the activities defined on the default path are executed.

Previous Document Next Document