Skip to main content
4-Participant
Aug 12, 2013 4:02 PM UTC
Question

How to retrieve Display Name of an Attribute's Value?

Hi All,

This is Windchill 10 question.

I have an attribute called "DesignControl" with logical name - "ext.abc.DesignControl". It has discrete set values in format like - Internal Name / Display Name as:

Design_A / Design A

Design_B / Design B

.....

For a document when I execute following code, I always get the value of the attribute to be - "Design_A" instead of "Design A" which is the display value.

WTDocument tmpDoc = //Retrieved from search results

LWCNormalizedObject obj = new LWCNormalizedObject(tmpDoc,null,Locale.US,null);

obj.load("number","name","IBA|ext.abc.DesignControl");

System.out.println("Design Control Value - " + obj.getAsString("IBA|ext.abc.DesignControl"));

What other API should I be using to get the correct display value ?

Regards,

4 replies

12-Amethyst
Aug 22, 2013 5:41 AM UTC

Hi Sameer,

LWCNormalized API gives you the value which is stored and in case of discrete set values the internal name is always getting stored thats why its alwasys return you the internal name.

Translate
1-Visitor
Aug 22, 2013 3:49 PM UTC

You can using LWC API to help this function.

com.ptc.core.meta.common.TypeIdentifier identifier = wt.type.TypedUtility.getTypeIdentifier("soft type name");

com.ptc.core.lwc.common.view.TypeDefinitionReadView view= com.ptc.core.lwc.server.TypeDefinitionServiceHelper.service.getTypeDefView(identifier);

com.ptc.core.lwc.common.view.AttributeDefinitionReadView singleibaView= view.getAttributeByName("IBA name only");

// The key is 'displayName'.

String displayName= singleibaView.getPropertyValueByName("displayName").getValue(wt.session.SessionHelper.manager.getLocale(), false).toString();

Translate
4-Participant
Feb 8, 2018 1:40 PM UTC

Sorry, but may you please provide an complete example (working) using that feature in an infoengine task?
I did try, but I was unable to reproduce in my environment.

In fact I was trying to get the localized content of 'theTableColumnDefinition' field of 'com.ptc.core.htmlcomp.tableview.TableViewDescriptor' class output,

Translate
4-Participant
Jan 23, 2019 9:39 AM UTC

May you please write an exemple when it's not IBA field like: objName, objDescription, iteration.note, etc.?

Translate