Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
I have a WTPart which I need to delete. This WTPart was used in one (the latest) iteration of an assembly. Before I can delete the WTPart, I need to delete the latest iteration of the WTPart assembly it is used in. However, I can't seem to delete this latest iteration because of anEPMBuildHistorylink on the assembly. Is there a way to remove this link so I can get rid of the assembly iteration, and ultimately delete the WTPart?
Thanks
Max,
In short yes you can do it (I do it all the time) but not in the GUI. The link objects (there could be more than one) linking the WTPart to the EPMDoc need to be deleted first. This can be done in Oracle or using a Delete-Objects webject. Both are easy to do. I am generally track this stuff down in Oracle but then delete using a webject if GUI delete is not available.
Here's what you need to do.First get the id number of the WTPart you can get this from the WTPart's URL after the "%3A" or an Oracle query. If you have lots of iterations of this object you should run the query below on the id of each iteration (No telling who linked what to what in previous iterations).
Once you have the id go to Oracle and run:
select ida2a2 from EPMBuildHistory where CLASSNAMEKEYROLEBOBJECTREF='wt.part.WTPart' and IDA3B5=<your wtpart's=" id=" number=">;
this will list the id number of all EPMBuildHistory links that reference your WTPart.
From here you can delete EPMBuildHistory. I recommend doing any delete of this nature this with a Delete-Objects webject.
If you want to delete form sql
delete from EPMBuildHistory where ida2a2=<the ida2a2=" from=" the=" query=" above=">;
commit;
Once all links are deleted go back to Windchill and delete the WTPart using the GUI.
I always recommend as best practice deleting with a webject rather than Oracle because a webject delete will cleanup after itself meaning it will not leave any orphaned objects and if for any reason the delete is not possible you will get an error message stating what went wrong. DON'T DELETE from sql command unless you really know what you are doing!
FYI, All link objects in Windchill have one A role (From) and one B role (To). Any object that occupies the B role cannot be deleted using the GUI until the link is deleted. When deleting using the GUI an object that occupies the A role the link is automatically deleted.
If possible I ALWAYS delete using the GUI as this is the safest thing to do. If that is not possible I use a webject or API. SQL delete is used sparingly.
Hope this helps,
David
In Reply to Max Spencer:
I have a WTPart which I need to delete. This WTPart was used in one (the latest) iteration of an assembly. Before I can delete the WTPart, I need to delete the latest iteration of the WTPart assembly it is used in. However, I can't seem to delete this latest iteration because of anEPMBuildHistorylink on the assembly. Is there a way to remove this link so I can get rid of the assembly iteration, and ultimately delete the WTPart?
Thanks
Hi David,
I can't seem to find a webject to delete this reference. Do you have an example to do this?
I'm completely new to webject expressions.
Thanks in advance