Skip to main content
4-Participant
August 12, 2013
Question

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

  • August 12, 2013
  • 2 replies
  • 4950 views

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,

2 replies

12-Amethyst
August 22, 2013

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.

1-Visitor
August 22, 2013

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

4-Participant
February 8, 2018

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,

4-Participant
January 23, 2019

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