Skip to main content
15-Moonstone
October 9, 2017
Solved

Query to get all the available object types within a selected context in Windchill

  • October 9, 2017
  • 1 reply
  • 3033 views

Hi All,

 

I just need to write a query to get all the available object types within a selected context.

 

Can you please let me know how to query the same and to which tables in Windchill should I be viewing to write that query ?

 

Can anyone please let me know about it ?

 

Thanks and Regards,

Aditya

Best answer by abhishekarya

1. You won't be able to write a direct SQL query to retrieve all the Object Types unless you write select * and do a union of all tables.

2. I would highly recommend a Java Program as follows, You can pass the Container Name as an argument in the method, You can create a little utility which can output an excel report based on the Container you provide on the command line, Let me know if you need more help with that.

QuerySpec qs = new QuerySpec(WTContained.class);
QueryResult allContained=PersistenceHelper.manager.find((StatementSpec)qs);

while(allContained.hasMoreElements())
{
WTContained obj=(WTContained) allContained.nextElement();

//logger.debug("-Business Object is instance of WTContained -");

WTContainer container = obj.getContainer();
}

1 reply

aachanta15-MoonstoneAuthor
15-Moonstone
October 11, 2017
Hi All, Kindly let me know any leads or inputs on the same. Thanks and Regards, Aditya
14-Alexandrite
October 11, 2017

1. You won't be able to write a direct SQL query to retrieve all the Object Types unless you write select * and do a union of all tables.

2. I would highly recommend a Java Program as follows, You can pass the Container Name as an argument in the method, You can create a little utility which can output an excel report based on the Container you provide on the command line, Let me know if you need more help with that.

QuerySpec qs = new QuerySpec(WTContained.class);
QueryResult allContained=PersistenceHelper.manager.find((StatementSpec)qs);

while(allContained.hasMoreElements())
{
WTContained obj=(WTContained) allContained.nextElement();

//logger.debug("-Business Object is instance of WTContained -");

WTContainer container = obj.getContainer();
}

aachanta15-MoonstoneAuthor
15-Moonstone
October 17, 2017
Thank you Aarya.