Switch activity
When you are working in the BMC Atrium Orchestrator Development Studio application, the Switch activity allows for conditional process paths to be executed, based on one or more conditions evaluating to true. If all case paths evaluate to false, the default path is taken.
When a Switch activity is placed on the process canvas, a Join object is automatically placed to the right of it. All paths originating from a Switch activity must be terminated at the corresponding Join activity.
The Join activity cannot be deleted individually. When a Switch activity is deleted, all activities connected to the Switch, together with the Join activity, will be deleted together as a group. Activities contained between the Switch and Join can be deleted individually.
The Switch activity is pre-populated with two ports, Default and Case1. The default port's chain of activities is executed in the event no case port path conditions evaluate to true.
An unlimited number of case ports can be added. To add additional ports, right-click on the Switch activity in the process canvas and select Add Port from the menu.
If additional ports are added and subsequently found to be unnecessary, the extra ports can be deleted. To delete a port, place the mouse pointer over the unwanted port until the arrow changes to a hand pointer, then right-click and select Delete Port from the pop-up menu.
When a port on the Switch activity is connected to another activity, the connecting line will contain a label. This label has a default value of the port name, but can be changed by clicking on the label and typing the line label text.
The Property Panel for a Switch activity consists of three tabs, Properties, Logging, and Metadata. The Logging and Metadata tabs follow the layout and principles outlined in previous sections of this document.
The Properties tab for the Switch activity contains only one field, Execute All Cases. The options for this field are true or false. When set to true, ALL case paths whose conditions resolve to true will be executed. When set to false, only the first case path encountered whose conditions resolve to true will be executed.
The following table provides an example of the cases that would be executed given each option for the Execute All Cases field. The case path condition, either true or false, is provided for each sample case.
Switch activity - execution sample
Option | Case -1 evaluates to false | Case 2 -evaluates to true | Case 3 - evaluates to true |
---|---|---|---|
Execute All Cases set to true | skipped | executed | executed |
Execute All Cases set to false | skipped | executed | skipped |
Define the conditions for the case path on the properties panel for the linking arrow between the Switch activity and the first activity on the case path.
To access the Switch activity case path properties
- On the BMC Atrium Orchestrator Development Studio process canvas, double-click the linking arrow for the path you want to revise.
- Click the Add button to create a new condition.
Examples
The following topics include examples that use the Switch activity.
Configuration-items includes a video that demonstrates how to use module configuration and the switch activity to control the execution of the workflow.
While-loop-example-Look-up-available-hostname includes an example of using the While activity to look for the next available hostname in a user's environment. The workflow uses the Switch activity.