Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: Converting IBA UNIT Values as per Measuring System in Client Preference

$
0
0

I found the solution on how to convert the Classificaiton unit values to a different measuring system as per selected preference at Org Level.

 

attrValue is AbsrtractValue from a IBA holder like WTPart.

classAttr is the Classification Attribute.

orgPreference is the Measuring System selected at org Prefence.

 

Solution:

 

value=IBAValueUtility.getLocalizedIBAValueDisplayString(attrValue, locale);

                                                                                                    String preferenceUOM = classAttr.getDisplayUnits(orgPreference);

                                                                                                    value=value.replaceAll(classAttr.getQoM().getBaseUnit(), "");

                                                                                                    value= value.trim();

                                                                                                    Unit u= new Unit(value, classAttr.getQoM().getBaseUnit());

 

                                                                                                    DecimalFormat df = new DecimalFormat("####.####");

                                                                                                    double dd=u.convert(preferenceUOM);

                                                                                                    value=df.format(dd);

                                                                                                    value = value.concat(" "+preferenceUOM);


Viewing all articles
Browse latest Browse all 8876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>