cancel
Showing results for 
Search instead for 
Did you mean: 

Attributes are not formated correctly when read through API

Former Member
0 Kudos

I have an attribute with the Attribute Detail set to:

Numeric

Ratings = Normal

Dimension=Length

Default Unit=inches

decimal places=2

Show Fractions=true

When i retrieve this attribute through the API, I get the full number of decimals returned instead of the 2 that is set in the Attribute detail. Any idea why?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Yes, there should be a seperate forum for API related questions.

Former Member
0 Kudos

I am sorry, I am using version 5.5 SP3. Those objects do not seem to be part of this version. Would you have any suggestions for the version.

Thank you for your reply.

Former Member
0 Kudos

It's a bug. You're going to have to set the decimal places yourself or upgrade to SP4.

Don't you think there should be a seperate forum just for API related issues?

Former Member
0 Kudos

Hi,

The GetString function I mentioned was for the Java MDM4J API. However, a similar function exists in the COM API and has been around since the earliest days of the API.

The function is called <b>GetString</b> and exists in the <b>CharacteristicValue</b> class. Its signature is:


String GetString ( int DimensionID , int DecimalPlaces , boolean AllowFractions , int ConvertToUnitID )

If you are not interested in converting the Unit, set <i>ConvertToUnitID</i> to -1. The other values can be obtained from the <b>Attribute</b> class.

Walter

Former Member
0 Kudos

Hi,

Assuming you are using the MDM4J API, use the <b>MeasurementManger.GetString()</b> function to get formatted strings for attributes. Use the <b>AttributeInfo.GetXxx()</b> functions to supply the various parameters (eg. dimension, decimal places, etc.).

Walter

Former Member
0 Kudos

I haven't upgraded to SP4 yet, does this function exist in the SP4 COM API?