Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
How to get alternates and substitutes from parts through API?
What do uou mean? Actually I don't understand about alternates and substitutes of part. Part is WTPart?
From th part 'PART-001046', I need its alternte part 'IR-0000000018'.
Just check whether the below query helps for Alternate parts.
QueryResult qr = wt.part.WTPartHelper.service.getAlternatesWTPartMasters(WTPartMaster);
Similarly you can use below API for Substitute Parts. The below API will give u Usage Link from which you can get the WTPartMaster.
getSubstitutesWTPartMasters(WTPartUsageLink usageLink)
HTH
Regards,
Ratnadeep
Below code is to get the alternate part info (name,number ..etc )
================================================
WTCollection alternateLinks = WTPartHelper.service.getAlternateLinks(WTPartMaster);
if(alternateLinks != null) {
for(Iterator it2 = alternateLinks.persistableIterator(); it2.hasNext(); ) {
WTPartAlternateLink alternateLink = (WTPartAlternateLink) it2.next();
WTPartMaster pm = alternateLink.getAlternates();
System.out.println("Part Number --------------->" + pm.getNumber());
System.out.println("Part Name --------------->" + pm.getName());
}
}
Regards,
Venkat