Switch Activity Ignoring Text/String Variable Value

Attempting to use the Switch activity to choose the next action, based upon the value of a String variable.

The variable has a value which exactly matches one of the given Cases but the Switch Activity insists on performing the Default activity every time.

Hi @cojeda1,

In the default I would put a log message to the actual value you are basing the switch on. It could be something as simple as a space at the end of an erroneous capitalization.

As an additional tip, the switch cases don’t require quotations if they are string type.

Best,

Cam

Thanks Cam. I’d triple checked the variable value with log messages.

It must be the quotes around the String value in the Case selection. Bit counter intuitive :slight_smile:

Thanks for your help. I’ll try it without the quotes. I can get rid of the, decidedly inelegant, chain of IF statements, too.

Regards,

Cesar

1 Like

Yeah, I know exactly what you mean. It seems to be the only activity from UiPath that doesn’t require quotations, perhaps because you already have to set the type within the switch activity :man_shrugging:

If that solves your problems, please feel free to mark my original reply as the solution to help future users!

All the best,

Cam

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.