[Help] Does Modulo (%) Work in Facer? (No)

I’m trying to use modulo (rest of integer division) for some expressions. In the online editor it works fine but not on my watch (Fossil Q Explorist). Does anyone know if it is supposed to also work on watches or is the fact that it works in the online editor a “fluke”?

1 Like

If it’s not in the official Facer documentation, then it doesn’t work.
And modulo is not.

1 Like

I didn’t find any recent report about this issue…
iI have this matter with modulo since few time (didn’t see any updates … hemmm) on my Fossil Q explorist with WearOS.
I use modulo combined with VAR mainly for making some layers transparent like below:
$(#VAR_1#+1000)%8==5?100:0$

… it works fine with Creator but not on my watch: ALL layers are visible.

Any suggestions or similar experiences ?
thanks for your help

Have you tried wrapping the entire math expression in its own set of parentheses? As in:
$((#VAR_1#+1000)%8)==5?100:0$

Facer does love its parentheses.

4 Likes

you get it ! Many thanks.

I still have same issue with the nested condition … try several position for the parentheses without the same success. Any idea? seems you speak “facer” fluently :wink:

$((#VAR_1#+1000)%8)!=6?0:$$(#DD#)<=20||(#DD#)>=356?100:$

Maybe it’s 'cause you’re missing the final else in that expression? after the final : colon:
$((#VAR_1#+1000)%8)!=6?0:$$(#DD#)<=20||(#DD#)>=356?100:HERE$

1 Like

unfortunately, it doesn’t work. it seems the first test ((#VAR_1#+1000)%8)!=6 isn’t done = layer is always visible …
I didn’t fill the last “Else” for having the “Null” case, as explained in this post.

> But for If-Then-Else conditions, I’ve hit up to a dozen with no trouble yet.
> If-then-(if-then-(if-then-(if then-(if then-nothing)))) and so on. the last ELSE (nothing) is null.

I continue my investigations… I will keep you posted :slight_smile:

1 Like

Sorry not a lot of time lately, I may be able to try and help out later tonight (Central Europe Time), though I’m sure someone will chime in soon enough as well!

1 Like

I’m not sure if nested if/then statements work. Generally if I’m trying to be really complicated I’ll move 1 expression to one axis, and the other to the opposite axis.

1 Like

Thanks guys, no matter at all ! Much appreciate your help. Always nice to discuss such topics. It helps me to progress and find new solutions… I’m still trying to find an alternative without that nested statements. Sometimes it works … sometimes not !

1 Like

So … time to say I wasn’t able to find a suitable solution. Nested expressions seem to work only in some special cases.
I solved my problem with an avoidance strategy, as proposed by @eradicator09. The first statement controls the opacity when the second statement moves the layers out of the screen!!!

Below the result I used for the agenda (zodiac pictures need to be visible when 1)layer activated 2) after a certain date 3) before a certain date)

It is my experience too that conditional expressions have a life of their own on Facer. I am not even sure if Facer knows what works where and when. If they do, they don’t publish this info… :thinking:

For nested conditionals, I have found that it is best to stick with a single comparison per nested condition; i.e.avoid Boolean logic; no && , ||
I have seen cases where && , || do work in nested conditionals (mostly as the last conditional as in your example), but others where it just does not work as expected… So I just try to avoid && , || when nesting.
Further, only the last conditional may (and under certain conditions must) have an else clause.

When staying within these “limitations / rules”, nested conditionals mostly work for me, but there are still exceptions. Sometimes it seems to work everywhere (Creator, web preview and on my Galaxy Watch) except in the watch preview in the Android app. When this happens, the condition as shown in the Android watch preview carries over to some watch brands (e.g. Fossil).

Facer is also very pedantic regarding parentheses. Parentheses are mostly required to the extreme in math expressions, but the same does not hold for Boolean logic…
Very frustrating for someone with a programming background.

@jeberuth did you try:

$((#VAR_1#+1000)%8)!=6?0:$$(#DD#)<=20?100:$$(#DD#)>=356?100:0$
?

I agree that avoidance of nested conditional is the best solution at present on Facer… :frowning_face:

In answer to the original question of this thread asked way back in Nov 2017, I guess the modulo problem has been solved or the function added since. Modulo (%) is now listed on Expressions | Facer Documentation and works reliably (at least I have not experienced any unexpected problems with it).

1 Like

$((#VAR_1#+1000)%8)!=6?0:$$(#DD#)<=20?100:$$(#DD#)>=356?100:0$ ?

Yes I tried but with no success on my Fossil … Nested expressions look not predictible to me…

Perfectly right, I polluted this topic with nested expressions. The original thread was for modulo.
So, it works but need some parenthesis:
I replaced x%y by ((x)%y)