I just want to explore 4 case in Switch. Saved as ShortDesc variable some text. If ShortDesc having doesn’t have any key word should choose case 1. If ShortDesc have “Strike 1” should choose case 2. If ShortDesc have Strike 2 should choose case 3. If ShortDesc have Strike 3 should choose case 4.
I need to operate Switch case as if shortdesc have keyword.
You’ll notice that the UiPath Swtich Activity works with int32, String, Object, array and in fact, any type you can browse to.
Just make sure all the types match up, both in the expression and the case. And in the case, leave out the quotes, otherwise the case will mess up. It’s one of the few cases in UiPath where a String is not double quoted.
Unfortunately, there is no way to do what you want using a Switch, since you cannot put an expression into the Case. You’ll have to use multiple If activities.
They don’t have to be nested. I see people do this a lot and it’s unnecessary. Just do consecutive If activities…
@Raina_Mani
We can do this using If condition within Switch case. Please find the below statement & snapshot and let me know if it is working for you
if(string.IsNullOrEmpty(ShortDesc),“Case1”,If(ShortDesc.Contains(“Strike1”),“Case2”,If(ShortDesc.Contains(“Strike2”),“Case3”,“Default”)))