Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Version: Windchill 12.1
Use Case: Need to change part subtypes for schematics
Description:
Is there way to change a Part to an Electrical Part Subtype? We have thousands of parts that cannot be used with new functionality because they are the wrong subtype. I've seen a few older posts, but I cannot access the PTC articles. I was wondering if anyone had any suggestions on how to do this.
Hi @Aaronm87
PTC provided a windchill shell tool to change the type, but this change can be done just for all objects of one type.
There is no option to set any conditions. So it is not usable for you as usual 😄
As I see the PTC does not allow to see the article where how to do so is described.
I found a way how to change the type directly in the database with any condition I needed, but it is really dangerous if you do not know what you are doing. It can corrupt the database consistency if you do a mistake..
general steps:
Create one WTPart with the target type in the Windchill
Login to a database
Find the target type definition in the database (you have to know where this definition is written)
Create a select statement with condition in the database to find what parts have to be changed
Create a update statement to update the information in the database based on the previous conditions.
PS> @Fadel has provided right article CS368420 - How to change type of existing objects with "ChangeTypeSql" utility in Windchill
PetrH
Here are the database statements
be sure that you use correct values from idA2typeDefinitionReference and branchIdA2typeDefinitionRefe
-- SELECT with INNERJOIN - use your condition with your part number that was crated with a target subtype
select PR.iterationIdA2iterationInfo, WTPM.WTPartNumber, PR.branchIdA2typeDefinitionRefe, idA2typeDefinitionReference,*
from WindchillDB.WTPartMaster WTPM
INNER JOIN WindchillDB.WTPart PR ON WTPM.idA2A2 = PR.idA3masterReference
where WTPM.WTPartNumber like '00%1%' or WTPM.WTPartNumber like '00%2'
-- UPDATE with INNERJOIN
update WTP
set idA2typeDefinitionReference='numberFromPreviousSelect' , branchIdA2typeDefinitionRefe='numberFromPreviousSelect'
FROM WindchillDB.WTPart WTP
INNER JOIN WindchillDB.WTPartMaster WTPM ON WTPM.idA2A2 = WTP.idA3masterReference
where WTPM.WTPartNumber like '00%1%' or WTPM.WTPartNumber like '00%2'
PetrH
refere to https://www.ptc.com/en/support/article/CS368420 for more info on subject
Hi @Fadel
This is exactly the way 😄 I'm just suprised that older article is not viewable where the type change was described.
not viewable
https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS7287
yours is viewable.
https://www.ptc.com/en/support/article/CS368420
PetrH
Hello Petr, CS7287 , has been made internal to PTC as it has now info that need to be kept internal