The Switch activity in Oracle ICS is same as the switch statement in Java. The switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via a multiway branch.
Let’s take a quick look at how to use Switch activity that allows us to call different options based on the conditions.
Let’s create an orchestrated integration in which we’ll use the Switch activity.
We will assume that we already have an Orchestrated integration in place. Open the Actions from the right side, drop Switch action on the integration canvas
We will notice that two branches have been created by default, one is if and other is the default(Otherwise)
Click on the Undefined and click on Edit icon
An expression window will get open, that will allow us to add conditions
Let’s drag $tracking_var1 in the first box and enter any literal to match in the second box. Select the operation(>, < ,= ,>= ,<=,!=) from the drop down between these two boxes
Click + sign to add another condition to the same block
Match drop down allows us to put and/or between two conditions:
- All of: This means all the condition should meet. It is just like and operator
- Any of: This means any condition should meet. It is just like or operator
Let’s select All of here and put the expression as below
Click on the Expression Mode button to see the condition in Expression view
Notice that an and operator between two conditions. It is because we have selected All of from the Match drop down in the preceding options
Click Validate and Close button
We can add multiple cases in a single switch. Let’s add one more. Click on Switch activity and + sign
Add the conditions same way we added in previous steps.
Note: ICS UI doesn’t support to add another block at the desired position. So please add the cases carefully. Let’s suppose, you have added 1,2,3 case block and later you want to add one more case between 1 and 2, you won’t be able to add, as new block always be added in the last.