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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

fixed decimal value

Sruthi
15-Moonstone

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 6
yhan
17-Peridot
(To:Sruthi)

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

Sruthi
15-Moonstone
(To:yhan)

Is there any other solution other than this?

yhan
17-Peridot
(To:Sruthi)

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

slangley
23-Emerald II
(To:Sruthi)

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

mgoel
17-Peridot
(To:Sruthi)

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.

mgoel
17-Peridot
(To:Sruthi)

@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

Announcements


Top Tags