Switch / Case Confusion


#1

1) Give a description of the problem
Case evaluation is not working as anticipated

2) What is the expected behaviour?
I have a series of virtual momentary switches, I want to have a switch block that has a case for each momentary switch with an action for a web request

3) What is happening/not happening?
The first case seems to always hit

**4) Post a Green Snapshot of the piston![image|45x37]

I am sure I am missing something fundamental, or possible barking up the wrong tree. In the end I will have a few dozen virtual switches that each make a web request, looking for the easiest way to envelop this without a single piston for each


#2

I figured something out that works, not sure i understand WHY but it does work:


#3

The problem in your first example is you are switching on both devices so both will always match so you get the first one. The switch statement should always contain only one item and then the case chooses what item that matches. Your second one is the correct way to do it.