Skip to main content
12-Amethyst
June 8, 2022
Question

How to get all Attributes of WTObject..?

  • June 8, 2022
  • 3 replies
  • 3314 views

I want to get all attribute Internal name which are related to WTPart or WTDocument

3 replies

Marco Tosin
21-Topaz I
21-Topaz I
June 8, 2022

Take a look at this article

Marco
12-Amethyst
June 9, 2022

Thanks @Marco_Tosin 

Plz help me with any API or programatic solution

 

HelesicPetr
22-Sapphire II
22-Sapphire II
June 13, 2022

Hi @RS_10128209 

the API does not exists or I don't know it.

 

You need to write code to find TypeDefinition and then get attribute list.

 

Here is a code for you that can work. Just define soft type internal name and it returns what you need.

For me it works

 

try
{
String typeName = "wt.epm.EPMDocument";
QuerySpec queryspec;
queryspec = new QuerySpec();
int idLWCObject = queryspec.appendClassList(LWCTypeDefinition.class, true);
CompositeWhereExpression andCondition = new CompositeWhereExpression(LogicalOperator.AND);
andCondition.append(new SearchCondition(LWCTypeDefinition.class, LWCTypeDefinition.NAME, SearchCondition.LIKE, typeName), new int[]{idLWCObject});
queryspec.appendWhere(andCondition, new int[]{idLWCObject, idLWCObject});
queryspec.appendOrderBy(new OrderBy(new ClassAttribute(LWCTypeDefinition.class, LWCTypeDefinition.MODIFY_TIMESTAMP), false), new int[]{0});

QueryResult qrTypeDef = PersistenceHelper.manager.find((StatementSpec) queryspec);

if (qrTypeDef.hasMoreElements())
{
while (qrTypeDef.hasMoreElements())
{
Persistable persistables[] = (Persistable[]) qrTypeDef.nextElement();
if (persistables.length > 0)
{
LWCTypeDefinition lwcObj = (LWCTypeDefinition) persistables[0];
ArrayList typeList = LWCCommands.getTypeAttributes("OR:" + lwcObj.toString());
for (Object typeAtribs : typeList)
{
if (typeAtribs instanceof AttributeDefinitionReadView)
{
System.out.println(((AttributeDefinitionReadView)typeAtribs).getName());
}
}
}
}
} else
{
System.out.println("nothing");
}

} catch (Exception e)
{
// TODO: handle exception
e.printStackTrace();
}

 

PetrH

HelesicPetr
22-Sapphire II
22-Sapphire II
June 8, 2022

Hello @RS_10128209 

Go to the Type and Attribute Management and check all subtypes what you want.

There you can see all internal names.

HelesicPetr_0-1654688966658.png

 

PetrH

12-Amethyst
June 9, 2022

Thanks @HelesicPetr 

but I want solution programatically /using API

avillanueva
23-Emerald I
23-Emerald I
May 5, 2023

There is a page to see them:

Windchill/app/#ptc1/carambola/tools/createtableview/availableAttributes

Add that your you hostname and URL for your server.