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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

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

SD
4-Participant
4-Participant

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 4
KD
12-Amethyst
12-Amethyst
(To:SD)

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.

TZ
12-Amethyst
12-Amethyst
(To:SD)

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();

CarlosNunes
4-Participant
(To:TZ)

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,

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

Announcements


Top Tags