How can we retrieve Orphan Parts or Parts with no relation from Database?
I mean how can we get all the parts in the system that are not related to any Assembly, they are just components bearing no relation to any other part what so ever.
We can fetch such parts by making a query to all Parts but my concern is would it really be feasible to go with such approach if we have huge number of Parts in the system. Please advise.
Thanks in advance.
Hi Mithun,
The easiest way to do this would be to create a Query Definition that returns parts matching your criteria. I can think of three different conditions to check to find the "orphan parts" in your system.
- The classification of the Part is not equal to 'Assembly'
- The Part has no Part BOM relationships
- The Part is not the related_id of any existing Part BOM relationships in the system
If you haven't used query definitions before, you can check out our Introductory blog. Additionally, if you need to do anything with the orphan parts returned, you can check out this blog post on using query definitions inside your method code.
Chris
Christopher Gillis
Aras Labs Software Engineer