Ternary operator in text field showing FALSE after installing WFS beta

In some sense limit protect code from over complexity and vulnerabilities…

So still better to use the lastest version of wfs and work around the limitations or restrictions

@theslavetoart

Thanks for posting this

Upon investigating the matter, we discovered that the root cause lies in a preexisting issue related to quotation marks in version 1.5.
Specifically, using “ ” instead of “” in expressions would lead to problems, as seen in the example below:
([LANG_LOC]==“en_US”? 0:100)

This issue was addressed in version 1.6.9. However, we encountered a new finding during our investigation.
It appears that when “ ” containing an apostrophe is used alongside the colon : in the ternary operator’s execution part, unforeseen errors occur. Please refer to the example provided below:
([MIN] == 0? “O’Clock”: “O’One”)

We have decided to fix this issue in the upcoming release.
In the meantime, for those who are currently using version 1.6.9, we suggest the following workaround as a temporary solution:

  • Workaround: Replace " " with “” and replace ’ with ′.

Ron
Samsung Developer Relations

2 Likes

Both look the same can show the correct example?

What the difference our keyboard only got one " or ’
Cant type the replacement

How you get the other quotes

Not sure i understand

" " with space and "" without space will have different result.
For example text field with([IS_24H]>0?"":[AMPM]) when time in 24H mode it will show nothing in WFS, but in the watch device will show FALSE.

Let see in this part (([MIN] == 6)? “O’'Six”: you put two single quote inside of ""

1 Like

Still dont understand

This has no space in btw qoutes but has issue @r.liechty_SDR ?

So what the work around

@theslavetoart see the mistake the double ’ instead of one.

Didnt see that…

Could be the issue.

@theslavetoart

I made this test . I don’t think the conditionals should be nested .
.
.
Obviously it still has errors . as above .
(([SEC]==0)?“O’Clock”:" “)(([SEC]==1)?“O’One”:” “)(([SEC]==2)?“O’'Two”:” “)(([SEC]==3)?“O’Three”:” “)
.
.
This works perfectly .
(([SEC]==0)?“O_Clock”:”“)(([SEC]==1)?“O_One”:”“)(([SEC]==2)?“O_Two”:”“)(([SEC]==3)?“O_Three”:”")
.
.
I can not find an alternative ’ . Perhaps one of the experts can advise .
.
.
Screenshot_20240308_222601_sysui
Screenshot_20240308_223603_sysui
.
.
BTW Grabs from GW4 Classic .

@russellcresser nested in normal sense works…i do nested all the time.

1 Like

Also his code dont have " "

So why the errors

Am i blur or missing something where is the space in orignal code u guys talking about?

1 Like

Also look closerly guys its not the space its shape one is our keyboard ’ the other has a curve

Think @r.liechty_SDR please clarify as we are all wlid guessing

1 Like

@Knightwing Why would you nest stuff if it works as a Multi Conditional line ?

@russellcresser some equation cannot work…

As there any other if else statement needed

And if u are using + or * there are occasional that its add up two truth… e.g 1+1 = 2

But what we want is eithet 0 or 1

And i do not know why this work

But it doesn’t make sense.

To me which equation will it choose?

Suppose to display “” not o_three…

I guessing it buggy if u try one second or 2 second. It be false.

Or display

“”""Three o clock

So if i did this

(([SEC]==0)?“O_Clock”:”t“)(([SEC]==1)?“O_One”:”t“)(([SEC]==2)?“O_Two”:”t“)(([SEC]==3)?“O_Three”:”t")

You will get
ttt0_three

Your example is a “hack” as “” = empty char
.

1 Like

Ron said " " with a space would give an error . So I tried “” with no space . In Facer it is left blank . My formula making technique is Trial an error . For me if it works it works . On Facer we can only nest 3 conditional so I learned not to do it at all unless absolutly nessicary . Also Ron said that having ’ in the Text is an error . and we should use a different ’ . I could not find an alterative ’ so I just popped in the _ as I know it is not a forbidden CHR .

Where in @r.liechty_SDR reply talk about space?

I see it as the “” is different direction…

Think on keyboard press “alt key and some ascii code”

Anyway i think the issue is here

`(([MIN] == 6)? “O’'Six”.

Should be

(([MIN] == 6)? “O’Six”:

1 Like

Ok i guess ron is saying " " means with space inside quotes and “” means text without spaces?

But this ’ is confusing?

1 Like

May be I am not reading stuff correctly . But I must say at this stage I am horribly confused . It is a very long time since I had to play with Escape Codes and Asci number of CHRs .
.
.
.
Upon investigating the matter, we discovered that the root cause lies in a preexisting issue related to quotation marks in version 1.5.
Specifically, using “ ” instead of “” in expressions would lead to problems, as seen in the example below:
([LANG_LOC]==“en_US”? 0:100)

This issue was addressed in version 1.6.9. However, we encountered a new finding during our investigation.
It appears that when “ ” containing an apostrophe is used alongside the colon : in the ternary operator’s execution part, unforeseen errors occur. Please refer to the example provided below:
([MIN] == 0? “O’Clock”: “O’One”)

We have decided to fix this issue in the upcoming release.
In the meantime, for those who are currently using version 1.6.9, we suggest the following workaround as a temporary solution:

** Workaround: Replace " " with “” and replace ’ with ′.*

Ron
Samsung Developer Relations

Hey Ron thanks very much for the response… I would have responded sooner I have just been swamped at work… I will try this either tomorrow or Sunday when I have some free time and report back how it goes.

Like I said the code did work with the stable release 1.4.1.

Thanks again

1 Like

I am testing this . For some Mysterious Reason there are no errors but because of the Space between the " " the text is walking across the display of my Watch .
.
I have protected the format of this Paste .
.
.
(([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":" ")