Can switch be used for multiple cases and can they read a list of items?

I used a directly entered Array just to make it easy to screenshot. But if you have a string like:

Option1;Option2;Option3

Then you could use Split:

image

Split breaks up a string based on the supplied delimiter and returns an array.

Thanks Paul, does this array get output somewhere as a variable? I’m thinking I can put the if conditions in the body of the “for each” and just have them all in a list so it will execute whichever ones are needed.

If you already have a string like “Option1;Option2;Option3” you don’t need to store the array in a variable. You can convert it to an array for the For Each on the fly as I showed with split.

You could use multiple Ifs but Switch is generally cleaner. The result is the same though. Really a personal preference.

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