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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Real Number Attribute to string

hdasilva
13-Aquamarine

Real Number Attribute to string

Hello,

 

I need to convert a real number attribute to a string attribute rounded with 3 decimal places.

 

Example:

 

2.0000000000000E-2, on attribute "UNDERSIZE1"

Should be displayed on a new attribute with a value of: 0.002

 

How can I do this? I cannot make this change on Creo, I need to make it on Windchill, maybe using a calculated attribute with a formula?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Fadel
22-Sapphire I
(To:hdasilva)

OOTB ,this can be done with calculated attributes fucntions,yoy can use bround() for decimal precision and str() to convert to string  

Fadel_0-1700216094483.png

 

 

 https://support.ptc.com/help/wnc/r12.1.1.0/en/index.html#page/Windchill_Help_Center/typeattr/TypeMgrAttrFormula.html 

Fede

View solution in original post

3 REPLIES 3

Hi @hdasilva 

Use DataUtility customization and format the realnumber to string 

String format = "%.3f %s";
component.setValue(String.format(format, massDouble, unitString));

 PetrH

hdasilva
13-Aquamarine
(To:HelesicPetr)

Can you help me on how to do it??

Fadel
22-Sapphire I
(To:hdasilva)

OOTB ,this can be done with calculated attributes fucntions,yoy can use bround() for decimal precision and str() to convert to string  

Fadel_0-1700216094483.png

 

 

 https://support.ptc.com/help/wnc/r12.1.1.0/en/index.html#page/Windchill_Help_Center/typeattr/TypeMgrAttrFormula.html 

Fede
Top Tags