Community Tip - You can change your system assigned username to something more personal in your community settings. 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 uses
ConfigSpec
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