(Solved)How do I hide decimal and digits after a decimal?

Hello Experts,

Thank you for taking some time to read this post and trying to help me out! I have this simple issue where I don’t want to show any decimals or digits after decimals. Or maybe we can show just two digits after a decimal. Unfortunately couldn’t find any simple solutions to this problem.

You can check out a short video of the issue from here: Troubleshooting Decimal Display Issue 👀 | Loom

Looking forward to hearing from the experts! :innocent: :pray:

To get 0 decimal points:

trunc(Value)

To get 1 decimal point:

trunc(Value * 10) / 10

Two decimal points:

trunc(Value * 100) / 100

And so on
The value is multiplied by a multiple of 10, so you “save” a number of decimals equal to the number of 0’s this multiple of 10 has, then the other decimals are deleted by the truncate function “trunc()”, finally you divide by the same multiple of 10 to set the “saved” decimals after the floating point again.

1 Like

Capture

I can’t make it work! Can you please tell me how and where do I put the trunc?

Thanks!

You’re dividing a string by a number (that’s why to “/100” is underlined and in red).

Also, even if it were correct, all the equation is doing is multiplying distance by 100, and then dividing it by 100, which give you distance again.

You want use “ToString(trunc(distance * 100) / 100)” - don’t include the quotes.

And get rid of the GlobalVariableString(distance) bit too.

1 Like

Thank you so much! It’s working perfectly now, :pray: :pray: :pray: :pray: