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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. 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
4-Participant
4-Participant
(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
1-Newbie
1-Newbie
(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