Ternary operator in text field showing FALSE after installing WFS beta

This works Perfectly .
.
.
(([SEC]==0)?"O'Clock":"")(([SEC]==1)?"O'One":"")(([SEC]==2)?"O'Two":"")(([SEC]==3)?"O'Three":"")(([SEC]==4)?"O'Four":"")(([SEC]==5)?"O'Five":"")(([SEC]==6)?"O'Six":"")(([SEC]==7)?"O'Seven":"")(([SEC]==8)?"O'Eight":"")(([SEC]==9)?"O'Nine":"")(([SEC]==10)?"O'Ten":"")

@russellcresser told u your code is wrong

It separate coditions

1 Like

Ha Ha . I could not see that error . The formulas are so tiny on WFS .
.
.

1 Like

@russellcresser yup that the error, same as the @theslavetoart error.

1 Like

Hi @theslavetoart you cant say because previous version works means nothing wrong with your code…because usually when a version upgrade there is bug fixes or making syntac stricter. So what work previously may not work now.

After tighten of vulnerabilities etc. (Making your previously code weak or invalid)

And u need to change your expression to obey new rules

Make sense?

Another thing
Did you cut and paste or rewrite the code? Or u just upgrade from one wfs to another.

Could it be when rewriting u had a typo?
From your code i realised everything is same except for when [min]==6

As u see even @russellcresser make the same mistake even though he typing code twice

1 Like
([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"))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

@theslavetoart

try this. this works . i think it do to with ’
i tried removing the ’ at your 0’'six still false.
so i tried replacing all the ’ to _ and it works.

Not use why @russellcresser code works, but for me i tried

  1. 0’'six > 0’six
    Result false appeared on my watch

  2. replace all your ’ to _ and its work…

1 Like

Ha Ha. help :rofl:. I am not very grown up. With this formula making Bussiness. I am very frightened of that Formula. One tiny error and the whole thing is NOP. For me lots of little bits is easier to Debug. Tanks for that. I will check it out when my Laptop is on. I wonder how you highlight your code like that.

@theslavetoart and @russellcresser and @r.liechty_SDR

the previous test was done on 1.6.9

i decided to downgrade to 1.5.7 (beta) one version down.

and with this 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"))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

and it works perfect so @theslavetoart try this on 1.5.7 you shouldn’t have any problem.

Which version beta u using? Because your code which i used Reformated (this forum changed the double quotes for some reason) and it work with no issues on 1.5.7

If u using 1.6.9 i thinking its because for some reason you cannot have more then one single qoute ’ in whole expression.

As @russellcresser expression is multiple separate expression not a single nested expression code worked.

alternatively you can replace ’ with something else legal like _ or ,

another work around is 2 text layer stack together.

code for layer one

(([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":"")

This code is a “hack” all expression suppose to cat together its results
but since only one is true it shows the correct results and empty text for those is false

code for layer 2

([MIN]>=10? (([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":""))))))))))))))))))))))))))))))))))))))))))))))))))):([MIN]<10?"":"help"))

The remain MInutes.
P.s @theslavetoart
Sorry for some of my responses as i though it was your code syntac error because i usually coded with brackets so i wanted to make sure its not because of that.

But my point about code working for previous version doesnt mean no errors in any code still stands for reasons i stated.

1 Like

@theslavetoart if u need 1.5.7 wfs let me know…if u cant find it…i have it can upload it here…if there no size limit in the forum.

1 Like

I think the engineer said that the quote spacing issue was in 1.5 and an additional issue of the apostrophe was revealed there.

I think the smart quote was from a translation :slight_smile:

Ron
Samsung Developer Relations

2 Likes

seems like an easy solution would to just use the escape sequence for single quote in XML? I haven’t tried it and I left my computer at work but it would seem that shouldn’t throw an error in the parser? I know basically what watchface studio is is an IDE for watch face format… I have actually taken the generated files and worked with them in Android studio to use more advanced features of the language.

&#apos; or ' are the sequences.

Lol &# 39; but without the space works on these forums :laughing: to create single quote

Thanks sir… haven’t had much time to mess with it but I think the answer lies with escape sequences in XML for special characters… to produce a single quote… haven’t tested it yet but this is the proper way to do it according to strict XML syntax which is what watch face studio outputs.

Thanks for your solution but here in the states when we say the time it is o’clock … o’one … etc and the teens are fifteen sixteen… etc.

Hi, dont understand what u asking…try my solutions it works as u want

I did from o’clock to o’nine (layer one)
Then teens …(layer two)

Just overlap the layers…

The first layer will not show anything after [MIN]==9
Then second layer ten to fifty-nine.

If u havnt tried it as i given it to you please dont make comments after u tried it.

For 1.5.7 your exact code works…just that at [min]==6
It displays 0’'six not 0’six

All I was saying is replace ’ with &#3 9; but take out the space after 3… that is the code for single quote.

This works on wfs? U mean? I think as yet wfs cant handle escape sequence…test and like us know.

As wfs does its own converting from your code to xml
Its like a parser.

Will test to…see if xml ascii code works in wfs or cause Nop code

1 Like

Hi,

the &#3 9; without spaces doesn;t work.

1 Like

I think you are over-complicating it, putting apostrophe in a formula where it is not welcome.
Why not simply place the texts next to each other like this in one text field O'([MIN]==0?"Clock":"")([MIN]==1?"One":"")([MIN]==2?"Two":"")([MIN]==3?"Three":"")([MIN]==4?"Four":"")([MIN]==5?"Five":"")([MIN]==6?"Six":"")([MIN]==7?"Seven":"")([MIN]==8?"Eight":"")([MIN]==9?"Nine":"")

And another textfield for the rest (use timeline or formula for opacity to show either one or the other…
([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":"")

2 Likes

Then the result: will be after 9

It will display 0’ten but for op case it should be just ten ,

Or for example 0’thirty-one

Where it should be thirty-one

So what op means 0’ only appears when 0 to Nine

1 Like

I corrected my self, I think it is doable with two text fields.
English is foreign language for me, I did not spot it right away.

1 Like