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

We are happy to announce the new Windchill Customization board! Learn more.

How can I get all WTParts in Windchill?

atemnikov
1-Newbie

How can I get all WTParts in Windchill?

Hello,

I need to get all WTParts, that contains in Windchill for one special report. How can I do it?

Thanks.

6 REPLIES 6
BhushanNehe
14-Alexandrite
(To:atemnikov)

If you are looking for a report you can use report manager or directly query in database. However, if you are looking to query them from Java, you can use QuerySpec, refer to an example below:

wt.query.QuerySpec qs=new wt.query.QuerySpec(wt.part.WTPart.class);

  wt.fc.QueryResult qr = wt.fc.PersistenceHelper.manager.find(qs);

  while (qr.hasMoreElements()) {

  wt.part.WTPart object = (wt.part.WTPart) qr.nextElement();

  }

Regards,

Bhushan

The following example builds a query for part numbers:

QuerySpec qs = new QuerySpec();

int classIndex = qs.appendClassList(wt.part.WTPart.class, false);

ClassAttribute ca = new ClassAttribute(

wt.part.WTPartclass, wt.part.WTPart.NUMBER);

qs.appendSelect(ca, new int[] { classIndex }, false);

Note that when the WTPart class is appended to the query, the selectable

parameter is false. The full object is not returned; only the number column is

returned.

Results are still returned in the QueryResult object. Each element of the

QueryResult corresponds to a row and is an Object array (that is, Object[]).

In this example, the number column is at index 0 for each element. The actual

Java type for each result is based on the table column and the JDBC SQL-to-Java

type mapping.

Cat
5-Regular Member
5-Regular Member
(To:atemnikov)

I recommend to use Report Management utility (location: [site] > [utility] > [Report Management])


For your reference, I attached sql file (i.e., part.qml).  I hope that you could make a report for part.


Please, let me know if you have any question.


report.png

If you will use Report Manager, I suggest you to join this group Reporting and to read also this article I wrote Resource for reporting

In it you can find lots of report ready to use.

Marco
adev-2
4-Participant
(To:atemnikov)

Hi Adrey,

you can use the sql query to get all the parts

select distinct wtpartmaster.name, wtpartmaster.WTPARTNUMBER, wtpart.VERSIONIDA2VERSIONINFO, wtpart.ITERATIONIDA2ITERATIONINFO,

wtpart.LATESTITERATIONINFO

from wtpartmaster,wtpart

where wtpartmaster.IDA2A2 = wtpart.IDA3MASTERREFERENCE and wtpart.LATESTITERATIONINFO = 1;

KD
4-Participant
4-Participant
(To:atemnikov)

Hi,

If you want you can fetch all the part using info*engine Search-Object webject as well.

Regards,

Kaushik

Top Tags