Distance calculation in Km

Using the following formula, posted by another colleague on this forum:

(([SC]*0.762-[SC]*0.762%1000)/1000%10).(([SC]*0.762%1000-[SC]*0.762%100)/100)(([SC]*0.762%100-[SC]*0.762%10)/10)

I try to calculate and show the distance traveled in km. It has worked well until today, when I have walked more than usual and what happens to me is that when the steps exceed a certain number, the whole part goes from 9 to 0, disappearing the 1 of 10. Specifically in step 13124. What I see is:

step 13123 → 9.99 Km
step 13124 → 0.00 Km

and from here begins a new count 0.01 - 0.02 … which I understand is because the 1 of the tens disappears.

Someone else happens? What am I doing wrong?

Thank you all very much for this great forum and greetings.

1 Like

This is the correct formula:

(([SC]*0.762-[SC]*0.762%1000)/1000%100).(([SC]*0.762%1000-[SC]*0.762%100)/100)(([SC]*0.762%100-[SC]*0.762%10)/10)

3 Likes

It works!!!

Many thanks.

Guys, where do you need to put this formula so that the counting of steps in km works? “Tags” - not working

Hi.

In a component of type text, in ‘Text Field’

Regards

1 Like

This is the not correct formula. Not working. :frowning_face:

Taking into account that it is an approximate calculation because you manually enter the length of the road (0.762 m), it works for me.

As you can see in the graph, it tells me that 15000 steps are 11.43 km.

InkedCaptura 1_LI

2 Likes

((([SC]*0.745)-([SC]*0.745)%1000)/1000%100).((([SC]*0.745)%1000-([SC]*0.745)%100)/100)((([SC]*0.745)%100-([SC]*0.745)%10)/10)

This formula really works, have it implemented in my watchfaces;) Bold font shows the error of the original.

0.745 = length of my step in [m]

Now its ok - working.

thanks for sharing, I try it and work well

Not working :roll_eyes:

Try this:
(([SC]*0.00475)*1%1>=0.5?([SC]*0.000475)+0.1-([SC]*0.00475)*1%1/10:([SC]*0.000475)-([SC]*0.00475)*1%1/10) mile

3 Likes

Chrome copy-paste does not work well. In the end, the formula worked. Thanks!

Hello,

From this posts, I can select km/mile like below.
Could you please confirm this is right fomula?

km:
((([SC]*0.745)-([SC]*0.745)%1000)/1000% 100 ).((([SC]*0.745)%1000-([SC]*0.745)%100)/100)((([SC]*0.745)%100-([SC]*0.745)%10)/10)

mile
(([SC]*0.00475)*1%1>=0.5?([SC]*0.000475)+0.1-([SC]*0.00475)*1%1/10:([SC]*0.000475)-([SC]*0.00475)*1%1/10)

+one more thing

Can I distinguish km/mile by users’ setting?

BR

The formula for mile does not work
(([SC]*0,00475)*1%1>=0,5?([SC]*0,000475)+0,1-([SC]*0,00475)*1%1/10:([SC]*0,000475)-([ SC]*0,00475)*1%1/10)

I think you are using "," - use "." (Point)

Yes … that was it. thanks

It doesn’t work for me. Added text, added formula to text field. In studio it shows formula but on the watch nothing appear. Some clue ? I double check to have “.” and not “,”
What I am doing wrong ? Thank you.

for km try (numberFormat(“0.00”,[SC]/1330))

1 Like

Hi … in the WFS it is displayed correctly but not on the watch.

Image 1 WFS

Bildschirmfoto 2021-12-09 um 15.03.05

Image 2 Watch

Bildschirmfoto 2021-12-09 um 15.00.18