How can i add an extra few values to a String expression?

string
expression

#1

ok so i have taken a look through the WIKI but not had any luck finding my answer, the wiki is amazing and FULL of answers but i cannot find what im looking for, it probably is there i just had no luck finding it, can one of the clever people help PLEASE…

WIKI QUOTE
Ternary operator ( c ? t : f )
A great tool to simplifying expressions, the ternary operator evaluates c as a boolean, then if that evaluation is true, returns t, otherwise returns f.

is it possible to do a string like so…

{string([House : Alarm]) == ‘c’ ?’ [blue|Yes]’}

*c is just and example for the questionable string below

but with the following as the options

(c ? t1) (d ? t2) (e ? t3) (f ? t4)

t1 = yes
t2 = maybe
t3 = probably not
t4 = no

all i keep getting is the return false.


#2

Since i am not exactly following what you are asking i will try to just give an example.

([Dustin:presence] == ‘present’ ? ‘i am home’ : ‘i am not home’)


#3

That’s not quite what I meant. I have that working fine. I’m asking because the Alarm dth allows 4 options.
They are. Off,Strobe,Siren & Both.
I want a string that can display a different value for each possible option.

The Dustins presence that you explained only displays 2 options. 1 if it’s true and the other if it’s false.

I’m after 1 if it’s off. A different one if it’s strobe and a different one if it’s siren and a different one if it’s both.

Have I explained that a bit better? Sorry. I know what I mean in my head it’s just difficult to put on paper.

Thanks for the help, I really do appreciate it. :grinning: :+1:t3:


#4

Something along the lines of.

If it’s off then display “it’s OFF” but if it strobe then display “its FLASHING” or if it’s siren then display “it’s making a noise” of if it’s both then display “it’s FLASHING & Making a lot of noise”

{string([House : Alarm]) == ‘Off ’ [blue|It’s OFF]’ == ‘strobe’ [green|it’s FLASHING] == ‘siren’ [red|it’s making a noise]

I know that won’t work like I’ve done above but it’s just to try and explain what I’m after.


#5

Ok got it.

(condition == 1 ? ‘true’ : (condition == 2 ? ‘true’ : (condition == 3 ? ‘true’ : ‘false’)))


#7

Thank You for your help. Its All working as i wanted now…
CHEERS :beers:


#8

Awesome glad you got it. Sorry I missed your other post. Had to get to work haha!