Flow switch IF

Hi Folks,

if there a better (or shorter) way to write this?

I am using this for Flow switch.

if(strExch.StartsWith(“BDA”), “EAST”, if(strExch.StartsWith(“GLA”), “EAST”, if(strExch.StartsWith(“KTA”), “EAST”, if(strExch.StartsWith(“PRA”), “EAST”,if(strExch.StartsWith(“CGA”), “EAST”, if(strExch.StartsWith(“AMA”), “NORTH”,if(strExch.StartsWith(“PLA”), “NORTH”,if(strExch.StartsWith(“HGA”), “NORTH”,if(strExch.StartsWith(“NTA”), “NORTH”, if(strExch.StartsWith(“CTA”), “TOWN”,if(strExch.StartsWith(“CYA”), “TOWN”,if(strExch.StartsWith(“ESA”), “TOWN”,if(strExch.StartsWith(“OCA”), “TOWN”,if(strExch.StartsWith(“TBA”), “TOWN”, if(strExch.StartsWith(“ARA”), “WEST”,if(strExch.StartsWith(“BPA”), “WEST”,if(strExch.StartsWith(“JEA”), “WEST”,if(strExch.StartsWith(“JRA”), “WEST”,if(strExch.StartsWith(“JWA”), “WEST”,if(strExch.StartsWith(“QTA”), “WEST”,if(strExch.StartsWith(“TSA”), “WEST”, “Default”)))))))))))))))))))))

image

Hi @kelvinyeo24

You can do something like this…
First use an assign activity and get the first three characters of the string to s separate variable using sub string. So that you dont need to check the starts with command in each case.

Now, use that variable inside your flow switch of switch case activity. Now, for each value in the case or switch activity, provide the three letters you expect to have and the task you need to do based on that.

Make sense?

1 Like

Thanks Lahiru, will it out your idea…

1 Like