cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Display decimal values only when needed

jrumpza
5-Regular Member

Display decimal values only when needed

Does anyone know if it is possible to format a number value in a grid such that whole numbers will be displayed as integers and decimals will be displayed as decimals? We have a use case in which almost all numbers are whole numbers, but every once in a while a decimal value is needed. In order to improve the readability of the UI, we would like to be able to show those decimal values accurately without requiring all whole numbers to be displayed with unnecessary digits, such as "5.000".

1 ACCEPTED SOLUTION

Accepted Solutions
odukiya
14-Alexandrite
(To:jrumpza)

Hello @jrumpza 

 

Go to Configure Grid Column >Column renderer and state formatting and uncheck rounding enabled .You will be able to achieve your use case.

You can also refer the following post 

https://community.ptc.com/t5/ThingWorx-Developers/Format-number-without-meaningful-trailing-zeros-in...

 

If your issue is resolved please mark it as the Accepted Solution for the benefit of others in the community.

View solution in original post

4 REPLIES 4
odukiya
14-Alexandrite
(To:jrumpza)

Hello @jrumpza 

 

Go to Configure Grid Column >Column renderer and state formatting and uncheck rounding enabled .You will be able to achieve your use case.

You can also refer the following post 

https://community.ptc.com/t5/ThingWorx-Developers/Format-number-without-meaningful-trailing-zeros-in...

 

If your issue is resolved please mark it as the Accepted Solution for the benefit of others in the community.

View solution in original post

jrumpza
5-Regular Member
(To:odukiya)

Thank you! Yes, that did the trick. I had tried that earlier, but on a Value Display, where it does not work. But it does work for the grid, which is more important for my use case.

 

If there is also a separate solution that does the same trick for a Value Display as well, that would be great too.

odukiya
14-Alexandrite
(To:jrumpza)

Hello @jrumpza 

 

Value Display has a renderer that you can configure. Have you tried that?

 

Thanks

Om Dukiya

jrumpza
5-Regular Member
(To:odukiya)

I have - I set it up the same way as it is set up in the grid, but in the case of the Value Display, it always shows the decimal values, so instead of "5" it shows "5.000". Perhaps it is a bug. At least the formatting for the grid values works

Announcements