Select world time zones

I’m trying to add the ability to change time zones, with five select zones. My conditional doesn’t work, and I can’t figure out why.

Here’s what I’m trying to do, using an expression to cycle through the five selected zones.

I may add summer time zones for those cities above that use them, but that’s another hurdle that I’ll handle once I have the easy bit working.

So I use Var#2inc to cycle through and I want…

Var 2 = 0, UTC-5 NEW YORK
Var 2 = 1, UTC+2 PARIS
Var 2 = 2, UTC+3 MOSCOW
Var 2 = 3, UTC+9 TOKYO
Var 2 = 4, UTC LONDON

Splitting my equation out, I get…

$(#VAR_2#%5)=0?$$(#DUHZ#-5)>=24?((#DUHZ#-5)-24) : $
$(#VAR_2#%5)=1?$$(#DUHZ#+2)>=24?((#DUHZ#+2)-24) : $
$(#VAR_2#%5)=2?$$(#DUHZ#+3)>=24?((#DUHZ#+3)-24) : $
$(#VAR_2#%5)=3?$$(#DUHZ#+9)>=24?((#DUHZ#+9)-24) : $
$(#VAR_2#%5)=4?$$(#DUHZ#)>=24?((#DUHZ#)-24) : $
:#DUmZ#

minus the spaces of course…

…and putting it all together -

$(#VAR_2#%5)=0?$$(#DUHZ#-5)>=24?((#DUHZ#-5)-24):$$(#VAR_2#%5)=1?$$(#DUHZ#+2)>=24?((#DUHZ#+2)-24):$$(#VAR_2#%5)=2?$$(#DUHZ#+3)>=24?((#DUHZ#+3)-24):$$(#VAR_2#%5)=3?$$(#DUHZ#+9)>=24?((#DUHZ#+9)-24):$$(#VAR_2#%5)=4?$$(#DUHZ#)>=24?((#DUHZ#)-24):$:#DUmZ#

I don’t need the last 24hr excess check since the last one is basic UTC, but it shouldn’t make any difference if it is there. I can clean up that bit if the rest works.

All I’m seeing here is dollar signs. :smiley: Can anyone see why this isn’t working for me? IT’s probably a rookie mistake - I’m not very experienced using expressions, but I can’t see it.

You need to rewrite the formula, it cannot work unless it is written correctly

$(#VAR_2#%5)=0?Yeah_Do_something_here:$$(#VAR_2#%5)=0?Yeah_Do_something_here:$
1 Like

Ah, I’m missing the second part of each nested conditional.

So this still doesn’t work (my cleaned up code looks like this…

$(#VAR_2#%5)=0?$$(#DUHZ#-5)>=24?((#DUHZ#-5)-24):(#DUHZ#-5):$$(#VAR_2#%5)=1?$$(#DUHZ#+2)>=24?((#DUHZ#+2)-24):(#DUHZ#+2):$$(#VAR_2#%5)=2?$$(#DUHZ#+3)>=24?((#DUHZ#+3)-24):(#DUHZ#+3):$$(#VAR_2#%5)=3?$$(#DUHZ#+9)>=24?((#DUHZ#+9)-24):(#DUHZ#+9):$$(#VAR_2#%5)=4?(#DUHZ#):$:#DUmZ#

Unless Facer has been updated since 2018, it seems that it doesn’t like nested conditionals that are anything other than “=”. If that’s still correct, then I guess that would be a reason (not necessarily the only one!) for failing.

So, I guess I need a totally different way of doing this. Anyone got any ideas? Basically, I have a number of timezones that I want to cycle through, and add an offset to the UTC. The details are in my first post up top. The display will be digital, 24hr clock.

You need to simplify this formula, it just doesn’t seem to work logically to me, even if you write it correctly. Can I see your design? Perhaps by changing it, you can solve this problem.

1 Like

Your cleaned up code isn’t formatted correctly. I took a look at it and tried to clean it up with square brackets, but I really don’t understand what you are trying to do.

$(#VAR_2#%5)=0?[do_something:]$$(#DUHZ#-5)>=24?((#DUHZ#-5)-24):[(#DUHZ#-5):]$$(#VAR_2#%5)=1?[do_something:]$$(#DUHZ#+2)>=24?((#DUHZ#+2)-24):[$$](#DUHZ#+2)[<=>test?do_something]:$$(#VAR_2#%5)=2?[do_something:]$$(#DUHZ#+3)>=24?((#DUHZ#+3)-24):[$$](#DUHZ#+3)[<=>test?do_something]:$$(#VAR_2#%5)=3?[do_something:]$$(#DUHZ#+9)>=24?((#DUHZ#+9)-24):[$$](#DUHZ#+9)[<=>test?do_something]:$$(#VAR_2#%5)=4?(#DUHZ#):[delete$:]#DUmZ#[$]

Maybe look at these samples for formatting:

$#WCCI#==01?122:$$#WCCI#==02?122:$$#WCCI#==03?122:$$#WCCI#==04?122:1000$

$#DOW#=1?We:$$#DOW#=2?Th:$$#DOW#=3?Fr:$$#DOW#=4?Sa:$$#DOW#=5?Su:$$#DOW#=6?Mo:$$#DOW#=0?Tu:$

This sample has a couple of “and” conditions in for good measure:
$(#DWE#)<=0.5?(185-(#DWE#*360)):$$(#DWE#)>=0.5&&(#DWE#)<1?((250-(#DWE#-0.5)*360)-70):$$(#DWE#)>=1&&(#DWE#)<1.5?(185-((#DWE#-1)*360)):8$

The format to be used should be:
$A<=>B1?C1:$$A<=>B2?C2:$$A<=>B3?C3:C4$
where:
A is the initial item to test
<=> can be the test condition <,<=,>, >=,==
B1, B2, B3 and alternate possible conditions to test against
C1, C2, C3 and the result conditions to apply if B1, B2, B3 conditions are met
C4 is all remaining result conditions
$ if (at the beginning)
$ close (at the end)
:$$ else if
? then

1 Like

The problem is you are not nesting, you are putting multiple if statements behind each other.
Nesting has never been possible in Facer. Whatever you want the condition to control, it has to be inside the $ and $.
One way to solve it is combining all the options, which means you get twice the amount of expressions.
$(#VAR_2#%5)==0&&(#DUHZ#-5)>=24?((#DUHZ#-5)-24):$
$(#VAR_2#%5)==0&&(#DUHZ#-5)<24?(#DUHZ#-5):$
$(#VAR_2#%5)==1&&(#DUHZ#+2)>=24?((#DUHZ#+2)-24):$
$(#VAR_2#%5)==1&&(#DUHZ#+2)>=24?(#DUHZ#+2):$
etc

The easy way however, would be to make 5 layers with the time expressions
$(#DUHZ#+2)>=24?((#DUHZ#+2)-24):(#DUHZ#)$
and put the var expressions in the opacity fields:
$(#VAR_2#%5)==1?100:0$

Also, this one doesn;t make sense: (#DUHZ#-5)>=24?((#DUHZ#-5)-24):...
Shouldnt that be (#DUHZ#-5)<=0?((#DUHZ#-5)+24):...

1 Like

Thanks for all the responses and for sharing your knowledge so freely. It’s something I’ve never found on another tech forum.

I never thought about having each on its own layer, and making it visible or invisible. Will have to think about this, but that separates out the problems, and makes each conditional manageable, so I think this is the way forward for me at least.

The face in a slightly older version than is current is here.
This was my starting point with the world time thing and it was easy because they were all consecutive. Now they aren’t so easy, and so it complicated things for me. Layers separates out the problems in to compartments that are manageable. Thanks @ThaMattie. and you’re right about the -5 one… :slight_smile:

2 Likes

The people here are ALL fantastic, I’m extremely happy to be a part of this marvellous Community. HUGE thanks to all of you guys :grin:

Inspection is enabled:

No leading zero though, that’s another set of expressions… :stuck_out_tongue:

1 Like

Hi ThaMattie, just wanted to verify if these expressions that you mention work any more with Facer Creator. The unpublished version shows perfectly alright on preview however, the moment you publish that, the Hour portion does not display right once synced to smartwatch but the Minutes display as they should.

here is a sample from your Phoenix.Timezones

$(#DUHZ#+2)>=24?((#DUHZ#+3)-24)’:’(#DUHZ#+3)$:#DmZ#

for example, this showed as 166:21 once published (I tested and deleted). The 166 changes incrementally with the incremental change in hours like +3, +4, +5 etc.

Any new developments that we are to know? I do know they worked perfect the last year.

Thank you. Appreciate your comments on this!

Robson Ivan

1 Like