I’m working on a watch face using the Facer Creator that uses a few conditionals, but after poking around at the syntax for a while, I cannot get even the simplest conditional to work.
To test it out, I set up a
Text Object with the
Text field containing
$ #DISDAYTIME# ? Day : Night $. Up until I add the last
$, the output displays “$ true ? Day : Night” (as it should), but as soon as I stick the last
$ on there, the output goes blank. Syncing the face to my watch shows “$ true ? Day : Night $” as the text of the object, which is definitely not what it should do.
I’m running Facer 2.3.4_841 on my phone.
Does Facer Creator support conditionals?
Hey @harbichidian! Sorry about your frustration, to make conditionals work you’ll have to add a boolean operator and take out the spaces in the first segment of the conditional:
$#DISDAYTIME#==true?, so your final expression will look like this:
$#DISDAYTIME#==true? Day : Night $.
We’ll be updating the referencing page to make this more clear. Let us know if you have any other questions!
Ah, I definitely misunderstood that from the documentation. The way it is written appears to require spaces around the special characters. Thank you for the clarification!
I’ve tried the equivalent item in transparency. I have this expression:
$#Da#==“AM”? 66 : 30 $
I would expect this to evaluate to either 66 or to 30. It is evaluating to 0. If I assign it to a textbox, the result is empty.
I’ve got formulas working; this is the last thing I really need to comprehend for the design.
@CompuChip ~ if you remove the parentheses around AM, then your conditional should start working correctly. At least it did whenever I tested it.
Awesome and thanks! As a programmer, it never occurred to me to NOT quote my strings
I figured that out by sheer luck on a conditional I was messing around with yesterday.
Is it possible to do string-comparison conditionals where a string contains a space?
(#1) works as expected and yields
$xx==xx?"Its True":"Its false"$
(#2) does not work as expected and yields no result
$"x x"=="x x"?"Its True":"Its false"$
(#3) also does not work as expected and yields no result
$x x==x x?"Its True":"Its false"$
Can someone help me find a way to compare strings that contain spaces in them?
I know that there is a way to use strings in conditions, but right now I’m away from my work station.
Around Sunday I should be able to help you.
Thanks – any ideas on how to get strings with spaces in it working would really help out! Seems like it should be easy, but string comparisons in quotes do not seem to work (contrary to the example shown in the documentation: Conditionals | Facer Documentation –
$ #Da# == "AM" ? 1 : 0 $).
Ultimately, what I am trying to do is take a string that says one thing and reprint it as another thing (e.g. transform
"Los Angeles" to
"City of Angels").