While designing ETL data flows, we will come across some scenarios where we must branch the control flow based on a business rule or conditional expression. The easiest way to implement conditional branching, in Data Factory is by using the Switch Activity. It is very easy to understand and implement if you are familiar with the SQL Case Statement.
Switch activity is available under the Iteration & conditionals group. We have already discussed these activities briefly, in a previous post.
Using the switch activity, the control flow of the pipeline can be branched into multiple Cases based on a conditional expression. Each case in the switch activity can be used to pass the control flow to a new activity (or group of activities).
When we create a new Switch activity, it already has one case- the default case. This is the equivalent of the ELSE clause of the SQL Case statement.

The Expression property under Activities tab is a mandatory property and the branching is performed based on the expression evaluation.
Users can add more Cases using the Add case button.

Once the new case is added, by clicking on the pencil icon, users can provide the expression evaluation value for that case and design a new activity or set of activities to be executed when the expression value matches the case value.

Like the SQL Case statement, if the expression value matches none of the user created case values, the control flow will be passed to the Default case.
Reference: https://docs.microsoft.com/en-us/azure/data-factory/control-flow-switch-activity
2 thoughts on “Azure Data Factory: Switch Activity”