uipathuipath-studio

UiPath - how to use variables in switch/case


I'm just curious about switch/case in UiPath. Everywhere else in UiPath, strings must have double quotes or stored in variables, however in switch/case, it seems different.

Every "case" is interpreted as string, regardles of the quotes. How to use variables in there when they're interpreted as string?


Solution

  • You cant use variable in switch case in UiPath. However you can use following expression in Expression property helps switch dynamically.

    Array.IndexOf({var1,var2,var3},item.ToString)

    Something like below screenshot

    Variable in Switch Case

    Hope this helps