Ternary operator in text field showing FALSE after installing WFS beta

Hi, I made a watch face mostly for my own use… perhaps I will eventually upload it who knows. I’m sorry if this has been asked before I have googled and searched here and am really at a loss.

I am using nested ternary operations to display text in a field based upon the minute in hour so I can display “O’clock”, “O’one” etc… My code is very ugly and I wish there was a more efficient way to do this… if there is please let me know as I’m sure this slows down the watch lol… (Although it should only run when it approaches close a minute correct? I imagine some listener is present in the code…)

([MIN] == 0? “O’Clock”: ([MIN] == 1? “O’One”: ([MIN] == 2? “O’Two”: ([MIN] == 3? “O’Three”: ([MIN] == 4? “O’Four”: ([MIN] == 5? “O’Five”: ([MIN] == 6? “O’'Six”: ([MIN] == 7? “O’Seven”: ([MIN] == 8? “O’Eight”:([MIN] == 9? “O’Nine”: ([MIN] == 10? “Ten”:([MIN] == 11? “Eleven”: ([MIN] == 12? “Twelve”:([MIN] == 13? “Thirteen”: ([MIN] == 14? “Fourteen”:([MIN] == 15? “Fifteen”: ([MIN] == 16? “Sixteen”:([MIN] == 17? “Seventeen”: ([MIN] == 18? “Eighteen”:([MIN] == 19? “Nineteen”: ([MIN] == 20? “Twenty”: ([MIN] == 21? “Twenty-one”:([MIN] == 22? “Twenty-two”: ([MIN] == 23? “Twenty-three”: ([MIN] == 24? “Twenty-four”: ([MIN] == 25? “Twenty-five”: ([MIN] == 26? “Twenty-six”: ([MIN] == 27? “Twenty-seven”:([MIN] == 28? “Twenty-eight”: ([MIN] == 29? “Twenty-nine”:([MIN] == 30? “Thirty”: ([MIN] == 31? “Thirty-one”:([MIN] == 32? “Thirty-two”: ([MIN] == 33? “Thirty-three”: ([MIN] == 34? “Thirty-four”:([MIN] == 35? “Thirty-five”: ([MIN] == 36? “Thirty-six”: ([MIN] == 37? “Thirty-seven”:([MIN] == 38? “Thirty-eight”: ([MIN] == 39? “Thirty-nine”: ([MIN] == 40? “Fourty”:([MIN] == 41? “Fourty-one”: ([MIN] == 42? “Fourty-two”:([MIN] == 43? “Fourty-three”: ([MIN] == 44? “Fourty-four”:([MIN] == 45? “Fourty-five”: ([MIN] == 46? “Fourty-six”:([MIN] == 47? “Fourty-seven”: ([MIN] == 48? “Fourty-eight”:([MIN] == 49? “Fourty-nine”: ([MIN] == 50? “Fifty”:([MIN] == 51? “Fifty-one”: ([MIN] == 52? “Fifty-two”: ([MIN] == 53? “Fifty-three”:([MIN] == 54? “Fifty-four”: ([MIN] == 55? “Fifty-five”: ([MIN] == 56? “Fifty-six”:([MIN] == 57? “Fifty-seven”: ([MIN] == 58? “Fifty-eight”: ([MIN] == 59? “Fifty-Nine”:“help”))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

This worked just fine when I used my watch before… but since updating computers, WFS, and (possibly) wearOS… the text field just displays FALSE… This still diplays just fine within WFS but when I run on device is when I get the FALSE… I also purposely deleted a parenthesis from the end and ran on device and I notice it is rewriting the code like : ([MIN] == 0? “O’clock”:FALSE…

I’m sure there is a simple explanation for this that I am missing… also I know you can do these as a bitmap font but I would like to be able to change the font quickly without having to remake images…


Again sorry for the sloppy code and thanks ahead of time!

Syntac error do not delete the parantese.

([MIN]==0)? “O’clock”:(…))

The parantese are the issue

I’m sorry I must not have been clear but I only deleted one parenthesis to test and see what the text field displayed on my watch…

the code that I pasted above in its entirety is what I run… I have no FALSE written anywhere inside my code and all the parenthesis are accounted for… It runs fine inside WFS

Why not just make a Bitmap font for min1 and min2?

1 Like

Because I want to be able to change the fonts quickly and because 0-20 you would need to do special conditions anyways.

Nope your whole code are missing ) , go review your code closely, the false could be due to the errors u have

([MIN] == 46? “Fourty-

Where the ) after 46???

([MIN] == 46)? “Fourty-…

I do not need to show u more example of the errors?

Bro if someone post a reply explain what u missing but choose not to listen then we cant help u, so good luck

P.s watch and preview i have tested…sometimes the preview is less strict on syntac compare to on the watch

I’m sorry but you are wrong… These are nested operations meaning all the ) are at the end… look again.

Nope look

I know it nested but you still need to close the brackets

dont believe then suit yourself…good luck

Think you dont understand.

(([MIN] == 46)? “Fourty-":(([MIN]==47)?0:1))

EXAMPLE OF CORRECT NESTED

Each expression the conditions need to be open and close…because without the brackets the watch some how doesn’t recognise it as expression and mistake it wrongly

Thank you

Also if you would have read my post you would see that my code is working fine in WFS emulator but only has an error when using Run On Device testing, and it used to run just fine on my watch as well.

I guess I don’t understand what you mean lol.

so parenthesis around each == operation no matter what? I wonder why it works in emulator in wfs… and why it used to work on my watch.

Its u dont understand those are not the apprentice i taking about…

Maybe typo let me try again

([MIN] == 0? “O’Clock”: ([MIN] == 1? “O’One”: ([MIN]

To

(([MIN] == 0)? “O’Clock”: (([MIN] == 1)? “O’One”: ([MIN]

Beside your orignal code

Open and close

([MIN] == 0)

If still doesnt help.

Troublshoot by doing less nested code

E.g 1 to 5 see if still false results

(([MIN] == 0)? “O’Clock”: (([MIN] == 1)? “O’One”: (([MIN] == 2)? “O’Two”: (([MIN] == 3)? “O’Three”: (([MIN] == 4)? “O’Four”: (([MIN] == 5)? “O’Five”: (([MIN] == 6)? “O’'Six”: (([MIN] == 7)? “O’Seven”: (([MIN] == 8)? “O’Eight”:(([MIN] == 9)? “O’Nine”: (([MIN] == 10)? “Ten”:(([MIN] == 11)? “Eleven”: (([MIN] == 12)? “Twelve”:(([MIN] == 13)? “Thirteen”: (([MIN] == 14)? “Fourteen”:(([MIN] == 15)? “Fifteen”: (([MIN] == 16)? “Sixteen”:(([MIN] == 17)? “Seventeen”: (([MIN] == 18)? “Eighteen”:(([MIN] == 19)? “Nineteen”: (([MIN] == 20)? “Twenty”: (([MIN] == 21)? “Twenty-one”:(([MIN] == 22)? “Twenty-two”: (([MIN] == 23)? “Twenty-three”: (([MIN] == 24)? “Twenty-four”: (([MIN] == 25)? “Twenty-five”: (([MIN] == 26)? “Twenty-six”: (([MIN] == 27)? “Twenty-seven”:(([MIN] == 28)? “Twenty-eight”: (([MIN] == 29)? “Twenty-nine”:(([MIN] == 30)? “Thirty”: (([MIN] == 31)? “Thirty-one”:(([MIN] == 32)? “Thirty-two”: (([MIN] == 33)? “Thirty-three”: (([MIN] == 34)? “Thirty-four”:(([MIN] == 35)? “Thirty-five”: (([MIN] == 36)? “Thirty-six”: (([MIN] == 37)? “Thirty-seven”:(([MIN] == 38)? “Thirty-eight”: (([MIN] == 39)? “Thirty-nine”: (([MIN] == 40)? “Fourty”:(([MIN] == 41)? “Fourty-one”: (([MIN] == 42)? “Fourty-two”:(([MIN] == 43)? “Fourty-three”: (([MIN] == 44)? “Fourty-four”:(([MIN] == 45)? “Fourty-five”: (([MIN] == 46)? “Fourty-six”:(([MIN] == 47)? “Fourty-seven”: (([MIN] == 48)? “Fourty-eight”:(([MIN] == 49)? “Fourty-nine”: (([MIN] == 50)? “Fifty”:(([MIN] == 51)? “Fifty-one”: (([MIN] == 52)? “Fifty-two”: (([MIN] == 53)? “Fifty-three”:(([MIN] == 54)? “Fifty-four”: (([MIN] == 55)? “Fifty-five”: (([MIN] == 56)? “Fifty-six”:(([MIN] == 57)? “Fifty-seven”: (([MIN] == 58)? “Fifty-eight”: (([MIN] == 59)? “Fifty-Nine”:“help”))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

this does not work… it is the same error because those parenthesis don’t matter.

I dont think its a bug in the watch…its you missing something…

Can u do 1 to 5 instead.

So less nested…

It worked in watch many many times until I updated … it is this…

Bro its 2024 that was 2022 so…

What version is your wfs? And watch?

well it worked when I wrote it in November 2023 lol…

Anyway if u like that, i cant help u…

Anyway it could be too long expression…break it up to three or four layers…see if that helps

Then add opacity tag to each layers

Meaning ((([MIN] >= 0) * ([MIN]<=15))?100:0)

Then your text tag do for 1 to 15

And so on

I uninstalled the Beta and installed version 1.4.20 and it works.

1 Like

Hmm…but solution to by pass limit if there is…then do the breaking up of expression to layers

1 Like