Using Switch case in Microsoft Flow.
Hello Guys,
In our previous blog we have seen data operation like Parse JSON and Select. Today we will see how to use Switch Case with Microsoft Flow. But before If you are new to MS Flow then please read my this blog.
Do follow us to know more about Dynamics and Power Platform. Also if you like our blog then please comment and share this blog with your friends.
We all know what is switch statement and we have implemented it many times in various programming languages like C#, VB, Java etc. Basically we are using switch statement where we have multiple conditions to be checked.
A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case.
In our previous blog we merged data of three entities and stored it into an array. Now we will take an input from the user for which entity we have to merged data and store it into an array. Based on user input we will fetch data and will proceed further. To achieve this we will be using switch case.
Navigate to https://us.flow.microsoft.com and click on create. Select instant flow and configure it as below.
Expand manual trigger step and configure it as below.
Add a new step and search initialize variable and configure below variables.
Add a new step and search switch and configure it as below.
Now we will configure our first case i.e. for Customer. I our previous blog we have retrieved customer, parsed it in JSON, selected columns and added selected records into an array. Same step we will do here inside the case block. You can refer these steps from previous blog.
Now same case configuration we will do for Vendor and Partner.
Now add a new step below the switch step and search set variable and configure it as below.
if(not(empty(variables('Data String'))),
json(concat(concat('[',substring(variables('Data String'),
1,sub(length(variables('Data String')),1))),']')),json('[]'))
Hope it helps...
👍
ReplyDeleteThanks...
Delete👌👌👌👌🙏
ReplyDeleteThanks Sai...
Delete