Multiple values for comparison - staff, we've found several bugs here!

I’m trying to create an expression in which there are multiple values for comparison. The logic I’m looking for is $#Dd#=[1,21,31]?option1:option2$ so any value other than 1, 21, or 31 will result in option 2.

For the life of me I can’t figure out how to get it to accept more than one option. I’ve tried commas, pipes, every damn which way I can think of.

First things first, you need to use ==, not just one =.
As for the logic, you can use the || operator. Like this:

$ #Dd# == 1 || #Dd# == 21 || #Dd# == 31 ? true : false $

|| means if any of those conditions is true, you get a ‘true’, otherwise all of it stays ‘false’.
If you would use &&, you’d need all conditions to be true at the same time.

Thank you. This works, but I’m running into another barrier. it looks like you can only list three values for comparison in a single statement, so rather than have a whole bunch of statements, i was thinking about nesting the expressions.

This works in the editor, but in the app and on the watch, displays the nested expressions instead of a value.

$#Dd#==1||#Dd#==21||#Dd#==31?“st”:$#Dd#==2||#Dd#==22?“nd”:$#Dd#==3||#Dd#==23?“rd”:“th”$

Yeah, nested expressions are still buggy in the watch. I’m afraid it’s something they need to fix…

Here’s an awful hack, if you’re willing to try it. Instead of changing the value in one layer, stack a few atop each other.

Bottom layer: $#Dd#==1||#Dd#==2||#Dd#==3||#Dd#==21||#Dd#==22||#Dd#==23||#Dd#==31?"":"th"$
Next layer above: $#Dd#==1||#Dd#==21||#Dd#==31?"st":""$
Next layer above: $#Dd#==2||#Dd#==22?"nd":""$
Next layer above: $#Dd#==3||#Dd#==23?"rd":""$

The logic for the bottom layer:
Is today one of the special declared days? YES, don’t say anything, let the other layers handle it / NO, I’ll write out “th”.

The logic for the next layers above:
Is today one of the special declared days? YES, I’ll show my line, either st,nd,rd / NO, shut up and let bottom layer do it’s thing.

Yeah, that’s about what i was thinking. Not how I wanted to do it, but it’ll do for now. Just seemed crazy that I couldn’t use nested logic.

I don’t think the bottom layer will work as written. It only allows you to compare three items at once.

I’m not sure I can get this to work without either nested layers or more than three at once, unless there’s a way to say “hey, if this layer is active, then you aren’t.”

Finally got it to work, but man is it ugly.

The first layer has the date followed by a conditional to select “st” “nd” or “rd”. That layer uses the same conditional logic to decide if it should show up at all, though now that I think of it, that’s not strictly necessary.

The second layer uses the date followed by a “th” and uses the following terribly messy conditional logic for the layer itself:
$#Dd#==4||#Dd#==5||#Dd#==6?100:$$#Dd#==7||#Dd#==8||#Dd#==9?100:$$#Dd#==10||#Dd#==11||#Dd#==12?100:$$#Dd#==13||#Dd#==14||#Dd#==15?100:$$#Dd#==16||#Dd#==17||#Dd#==18?100:$$#Dd#==19||#Dd#==20||#Dd#==24?100:$$#Dd#==25||#Dd#==26||#Dd#==27?100:$$#Dd#==28||#Dd#==29||#Dd#==30?100:$

I was going to use the conditional logic from the first layer, in reverse, to do this, but while ?100:$ works, ?:100$ does not. The first value cannot be blank.

It’s messy, but it’ll work until facer can get nested logic fixed, more comparison values than three at a time, or allow a blank value for the first option.

Thank you for all the help Eno. Much appreciated!

Well, I was wrong.

I’ve got four separate layers and while they work great in the maker, they do not work on the watch itself.

At this point there hardly seems to be a point to making anything when half the functions are a completely mixed bag. Something as simple as $#Dd#==2||#Dd#==22?100:0$ for transparency isn’t working. Layer shows up in watchmaker, but doesn’t show at all on the actual device or when loaded up in the app.

Hello
I have a theoretical solution to displaying the date ordinal suffix.
BTW I had an issue where using division broke an expression - embarrassingly a work colleague suggested that I multiply by the decimal equivalent and that worked :smile:
The following works in creator:
$#Dd#==11||#Dd#==12||#Dd#==13?th:$$(#Dd#-floor(#Dd# * 0.1) * 10)==1?st:$$(#Dd#-floor(#Dd# * 0.1) * 10)==2?nd:$$(#Dd#-floor(#Dd# * 0.1) * 10)==3?rd:th$

The idea is that the 11th 12th and 13th are the dates that break the ordinal rules, so luckily testing for 3 values doesn’t break the conditional limit, then I calculate the units day number value and test for 1 then 2 then 3, else th…

Works in creator, but very unstable, crashes if you try and move stuff around.
Doesn’t work on watch e.g. 2nd shows 2ndth
I’ve published it as ordinal test - can’t find it through search - link is Ian Gough - ordinal test - watch face for Apple Watch, Samsung Gear S3, Huawei Watch, and more - Facer if anyone fancies fixing it :smile:

I’ve also just tried:
$#Dd#==1||#Dd#==21||#Dd#==31?st:$$#Dd#==2||#Dd#==22?nd:$$#Dd#==3||#Dd#==23?rd:th$
and that also works in creator, displays ndth on the watch

N.B. in the post I’ve had to add extra blanks before and after every * , otherwise the *s do not display
Cheers
snedger