Switch based on contains


I am trying to pass an URL to a Switch activity in order that if it contains : facebook it should run an activity , if it contains twitter it should run a different activity, etc.

But i am having issues with syntax.


can anyone help me develop a solution for my case?

1 Like


So Switches are slightly different than Decisions or If statements. The Cases should equal an Integer or String that the Expression returns (if that makes sense). The Expression should return exactly the string you are going to use as your Case so for example “facebook”.

In order to use .Contains, you can simply put that in the Expression. For example,

Expression:   If( row("URL").ToString.ToUpper.Contains("FACEBOOK"), "facebook", If( row("URL").ToString.ToUpper.Contains("TWITTER"), "twitter", "default" )

Then your cases would just look like:

Case1 facebook
Case2 twitter
Case3 default

I would also recommend using this in a Flow Chart, but that’s my opinion.

You can also consider State Machines. They allow you to use a full condition for the destination of each platform, that is, if each one uses a different process.



switch.xaml (6.5 KB)


Hi Clayton,

what will be the condition for the states?

Hi, what do you mean by your question @PriyaRK?
The conditions go in the Destinations part of the State, and you can put anything there that returns a boolean like text.Contains(“abc”), et cetera. When the State that processes is complete it will look at which destination to take in the order from top to bottom as they are listed in the Destinations section, and only if it is True.