Skip to main content
Apr 30, 2021 5:58 AM UTC
Question

fixed decimal value

Hi,

I am displaying some properties(decimal values) in property display widget. I need to restrict the values after decimal to 2 digits. How to achieve this in property display widget?

6 replies

Apr 30, 2021 6:09 AM UTC

Hi @Sruthi,

 

JS code like below can be used in service to restrict the values after decimal to 2 digits:

var num =2.446242342;
num = num.toFixed(2)

 

Thanks,

/Yoyo

SruthiAuthor
Apr 30, 2021 6:10 AM UTC

Is there any other solution other than this?

Apr 30, 2021 6:15 AM UTC

Hi @Sruthi,

 

I don't think there is any other solution except this, because we can only consider to restrict the decimal in service or mashup widget. The value display widget doesn't have this function in OOTB, so we can only consider to define that through service output. 

Or you need to consider customization on widget.

 

Thanks,

/Yoyo

May 10, 2021 6:23 PM UTC

Hi @Sruthi.

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

May 11, 2021 9:13 AM UTC

Hi @Sruthi 

 

I believe this thread is duplicate of https://community.ptc.com/t5/ThingWorx-Developers/fixed-decimals/m-p/727636#M51930

 

Could you please check and mark one of them as accepted solution if your already receive the solution.

May 24, 2021 5:36 AM UTC

@Sruthi 

 

Hi, In my last response i have posted the duplicate thread of this thread which is already marked as accepted solution. Could you please park this post accepted solution as well for the benefit of other community user and to avoid any confusion in future.

 

Regards,

Mohit