Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hello,
I need to get all WTParts, that contains in Windchill for one special report. How can I do it?
Thanks.
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.
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.
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.
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;
Hi,
If you want you can fetch all the part using info*engine Search-Object webject as well.
Regards,
Kaushik