My Switch doesn't act as expected

Touble with Switch
I am unable to identify the error. Can you lend me your eye? :eyes:
The Switch selects the Default case regardless of what year (value) the variable strYear has.

Thanks :speech_balloon:

Switch.xaml (11.0 KB)

Hi @bjorn2390,

It is because you are using variable in a CASE. It has to be a value you are looking to match.

This can be done in different ways, one of which is below, refer updated copy.
Solution 1::
Switch - Copy.xaml (11.0 KB)

Or You can also consider using year values directly in the case as in the below:
Solution 2::
Switch - year.xaml (10.8 KB)

But, I believe, solution 1 would be more apt for you.

Hope this helps.

Regards
Sonali

1 Like

Thank you so very, very much, @sonaliaggarwal47
You are right. The first solution is what I am after.
Can’t believe noone along the way ever told me that this would not work with variables in the cases.
Thanks for your time and effort.
Love from :norway:

1 Like

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