Skip to main content
1-Visitor
January 21, 2021
Solved

Display decimal values only when needed

  • January 21, 2021
  • 1 reply
  • 2231 views

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

Best answer by odukiya

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.

1 reply

odukiya16-PearlAnswer
16-Pearl
January 21, 2021

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.

jrumpza1-VisitorAuthor
1-Visitor
January 21, 2021

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.

16-Pearl
January 22, 2021

Hello @jrumpza 

 

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

 

Thanks

Om Dukiya