Switch Case with Variable at "Case"

I have read the documentation of the activity ‘Switch’ and know that I have first to define the type of input.
For my needs I select “string”. Now I want to iterate with “ForEach” over an array of strings.
The result is this:

At this point I run into a problem. I can use a default value at this point but I cannot use a variable that I want to be evaluated and the value of the variable compared to the string value.
As far as I know until now I have to know every value that can occur at this place first before I can use this activity.
May be that I’m missing something, but can someone show me a solution to the problem?

Thanks in advance


We cannot set variable in Case. However, the following expression in Expression property helps switch dynamically.



1 Like

Thanks for your answer. Yes, I can use this as workaround.

But in my opinion this is activity is not complete and can only be used rudimentarily.
For example: In C# it is defined that each case label defines a pattern that is compared to the match expression. This means that in C# it is possible to use complex objects at that point. I don’t want to ask for this entirely, but a little bit more flexibility would be welcome.

1 Like