Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
I am trying to retrieve Quantity attribute for BOM Structure.
WTPartUsageLink puLink = WTPartUsageLink.newWTPartUsageLink(part, partMaster);
puLink.getQuantity().getAmount(); //gives quantity 1.0 always.
The code you are using isn't actually looking at persisted data. You're essentially creating a "new" local WTPartUsageLink and I'm guessing 1.0 is the default value. If you would like to actually retreive the quantity from an existing link in the database, you need to get a reference to that link.
One of the APIs you could use would be:
WTPartHelper.service.getUsesWTParts(parents, configSpec);
Persistable[][][] getUsesWTParts(WTList parts, ConfigSpec configSpec) throws WTException
used-by parts to their usesConfigSpec to select the iterationsparts - Ordered list of used-by parts.configSpec - The config spec to use to select the uses part iterations.WTException
Once you have the link you can use your code above to get the quanity:
puLink.getQuantity().getAmount();
You could also check out this article to show you how to get the link:
Hi Jamie
Thanks for your help. It worked for me.
Regards
Rakesh
