Skip to main content
Jan 21, 2021 1:40 PM UTC
Solved

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".

odukiyaAnswer
Jan 21, 2021 4:57 PM UTC

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-Advanced-Grid/td-p/637280

 

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

4 replies

odukiyaAnswer
Jan 21, 2021 4:57 PM UTC

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-Advanced-Grid/td-p/637280

 

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

jrumpzaAuthor
Jan 21, 2021 7:18 PM UTC

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.

Jan 22, 2021 12:25 AM UTC

Hello @jrumpza 

 

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

 

Thanks

Om Dukiya