Decision Based Upon Name Of Switch

Hello. I’m trying to put an “if” statement in my app to set a delay based upon the name of a switch passed in as part of the preferences.
For example, if a switch is input as “Greet Jane” or “Greet John”, I want to set something for each within a single app.
Assuming preferences set “theSwitch”.
The statement log.debug "${theSwitch} shows: Greet Jane
But this fails:
if (${theSwitch} == “Greet Jane” {

What am I missing?

Put " around the ${theSwitch} and a closing parenthesys:

if ("${theSwitch}" == "Greet Jane") {

Ah. Excellent. Thanks.

1 Like