# Need help with step amount code

Hi all,

I wrote the code below which used to work. It should count from 7 am to 21:00 to get a goal off 7000 steps.
If time is 9 am and i walked 700 steps it should calculate 1000 - 700 and display 300.
Somehow this isnt working and i cant find out whats wrong.

`\$\$#DHZ#<=8?(#ZSC#-500):\$\$#DHZ#<=9?(1000-#ZSC#) :\$\$#DHZ#<=10?(1500-#ZSC#) :\$\$#DHZ#<=11?(2000-#ZSC#) :\$\$#DHZ#<=12?(2500-#ZSC#) :\$\$#DHZ#<=13?(3000-#ZSC#) :\$\$#DHZ#<=14?(3500-#ZSC#) :\$\$#DHZ#<=15?(4000-#ZSC#) :\$\$#DHZ#<=16?(4500-#ZSC#) :\$\$#DHZ#<=17?(5000-#ZSC#) :\$\$#DHZ#<=18?(5500-#ZSC#) :\$\$#DHZ#<=19?(6000-#ZSC#) :\$\$#DHZ#<=20?(6500-#ZSC#) :\$\$#DHZ#>=21?(7000-#ZSC#) :\$`

1 Like

Welcome @sharpa. A lot of people have posted about multiple conditional on one layer. Become a sort of competition. I am certain I am correct in saying Facer Recommend 3. They have been Tightening the Syntax restrictions recently to make the various OS systems served more compatible.
I am not in a position to help at the moment. One of the Code Masters might step in an help you with a single line Formula that does the same job. You sliding scale goal is only a direct function of the hour of the day.

1 Like

You could try removing all the spaces in the formula, might help. But, I too have have issues on my ticwatch with such long formulasâ€¦

2 Likes

Hi tom.vannes,

Thanks for your repky, unfortunately that didnâ€™t worked

1 Like

@sharpa for starters it seems illogical to have `>=` . I would have thought that just `=` was correct . I still have not got my head around exactly what is supposed to happen . I think you could make yourself a test with a Complication on each separate layer it is working fine for me without the `<>` .

`\$#DHZ#>=21?(7000-#ZSC#) :\$`

just try

`\$#DHZ#=21?(7000-#ZSC#) :\$`

NB if you look at the beginning of the formula grid you posted . There is an extra `\$` at the beginning that is a NOP .

So I have made a Test with separate layers I think I have done enough to give the Idea . See you need `<` and `>` on the first and last formulas . Smaller than `<` will always Show everything that is lower in value than the current hour regardless of the `=` sign .

If you are not sure how to Inspect this draft . Let us know .

I would gladly help, but cant understand how should this counter work. Why does it have to add 500 steps each hour, but subtract 500 in the first hour. Would you not want it to keep track of progress continuously rather than in hourly jumps?
I also wonder what is it supposed to show. Each hour there is one less condition met. Before 8h there would be 13 different numbers since all but last condition will be met (7 is smaller than 20 also smaller than 19 and so on).

1 Like