How to Use Switch Activity in Azure Data Factory - Azure Data Factory Tutorial 2021

 Issue: How to Use Switch Activity in Azure Data Factory.


In this article, we are going to learn How to use Switch Activity in Azure Data Factory, Azure Data Factory Tutorial 2021. The switch activity provides the same functionality, that the switch statement provides in a programming language, it evaluates the set of activities corresponding to the case that matches the condition evaluation. 

Let's start our demonstration, first of all, open the Azure data factory studio, and click on the pipelines, and then click on the new pipeline,  search for the switch activity in the activities bar and then drag into the working window, click on the switch activity and go to the General tab, Name the switch activity whatever you like, then click on activities, in the activities bar we have to write the expressions, click on Ass dynamic content, then click on pfile, it will add the parameter in the above window,  and then click ok. s shown in the picture below.

Fig-1: Add expressions to the switch activity.


Now in the activities bar, we are going to start adding the case statement, click on + Add Case, then give a name to the case, in my case, it is ''Customer'', then go to the working window then inside the Customer and bring the wait activity inside the customer,  and also name this activity too, in my case it is ''Customer Wait Activity'', then go back to the activities and add another case, and give the name, in my case, it is ''Product'', then click on the case and inside the product bring the wait activity, and nave the activity, in my case it is ''Product Wait Activity'', and finally click on the default case, and click on it and bring the Wait activity inside the default case and name it, in my case, it is ''On Default Delete file'', as shown in the picture below.


Fig-2: Add case statements in the switch activity.

Once we are done with our switch activity, go on the top and click on debug, once you click on debug it will ask for the file which you want to debug, In my case, I want to debug the customer file, then click ok and it will run the debug process, once the debug will be completed you can see the status which file the activity taken. as shown in the picture below.


Fig-3: Debug results of the wait activity

As you can see in the above picture the activity turns up the ''Customer wait activity'' as we provide the value for the parameter.  


Video Demo: How to Use Switch Activity in Azure Data Factory

1 comment:

  1. You there, this is really good post here. Thanks for taking the time to post such valuable information. Quality content is what always gets the visitors coming. Miraz Tony Denver Jacob dyna Vini Ramos Rahim Mina Taylor

    ReplyDelete