I am a teacher and want a face, that shows me the remaining time of my lessons. I want to use nested Ternary operators.
So I use:
(([HOUR_0_23]60+[MIN]<= 860+00)? “no lesson”: ([HOUR_0_23]60+[MIN]<= 860+45)? (8*60+45)-([HOUR_0_23]60+[MIN]):“…”)
this works! But when I want add a text in the expression:
(([HOUR_0_23]60+[MIN]<= 860+00)? “no lesson”: "1. lesson - "([HOUR_0_23]60+[MIN]<= 860+45)? (860+45)-([HOUR_0_23]*60+[MIN]):“…”)
this doesn’t work.
How can I concat my string "1. lesson - " with the calculated remaining time?
Is there a better way to do this? Can I use arrays? Can I call an web-Api?
Hello, it took me awhile to decipher what formulas and conditions are you using (I am still not 100% sure I got it right). The page uses the * sign as trigger for text formatting, so if it is in pasted formula multiple times, it gets omitted and parts in between turn italic. Can you please after inserting formulas mark them as preformatted text next time?
It seems the program does not like to place text result next to number in one step. So I tried to split them into separate conditions next to each other and it seems to work like this: (([HOUR_0_23]*60+[MIN])<(8*60)?"no lesson":"")((([HOUR_0_23]*60+[MIN])>=(8*60))*(([HOUR_0_23]*60+[MIN])<=(8*60+45))>0?"1. lesson - ":"")((([HOUR_0_23]*60+[MIN])>=(8*60))*(([HOUR_0_23]*60+[MIN])<=(8*60+45))>0?(8*60+45-([HOUR_0_23]*60+[MIN])):"…")
And I do not think you can call external API nor use arrays (maybe an external app trough complication), but I can be wrong here.
Thank you for your quick answer. And sorry - I am new here. I will format new questions in the right way. If I understand you right, there is no way to concat strings and numbers? Why?? I am a coder and this is the normals think ever. So this will be more complex and much longer. I have many different lessons and breaks between them. I hope the textfield has no problems with text longer that 1000 chars?
I will try it with your solution. But if anybody find a better way to concat strings and numbers, please send here.
I understand your confusion even though I am not a coder, just learned some things by trial and error, because not all details are described in documentation. Maybe some better combination of brackets (which should enclose parts of formula resulting in number) may improve it in unexpected way. I use notepad++ to keep track of the pairs at least.
Another thing is, how it will translate on actual watch. I have no watch with wearOS to test on, but I suspect some not described things may not work the same as in preview.