Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Version: Windchill 12.1
Use Case: At the time of migration, we have used few attributes which are used at the time of migration, now they are not at all needed, Since there are many, we need to delete in Bulk.
Description:
At the time of migration, we have used few attributes which are used at the time of migration, now they are not at all needed, Since there are many, we need to delete attributes in Bulk from.
There is no way to this with APIs or XML https://www.ptc.com/en/support/article/CS371027
https://www.ptc.com/en/support/article/CS368449
Hi @Fadel
It is not exactly right 😄
there is a mechanism that generates a xml for deleting a IBA attribute from a soft type.
during a import by loadfromfile there is information that xml for deleting is generated.
So you can use this xml as a template to generate own one to remove the attributes from the softtype
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE NmLoader
SYSTEM "standard12_0.dtd">
<NmLoader>
<csvDeleteAttributes handler="com.ptc.core.lwc.server.TypeDefinitionLoader.deleteAttributeDefinitions">
<csvattTemplate>LWCTYPE</csvattTemplate>
<csvtypeContext>wt.doc.WTDocument</csvtypeContext>
<csvdefNames>DATA|java.lang.String|EN_NAME , DATA|java.lang.String|ADDITIONALINFO</csvdefNames>
</csvDeleteAttributes>
</NmLoader>
PetrH
This is definitely doable.
There is no delete reusable attribute OOTB method, however, a custom Java class or sql script can be written to do this.
There is no OOTB API you can try.
I could certainly write the Java code to do it but I have not written it as of yet as I’ve not had any company request it.
Once a company request it, along with their exact specifications I’ll write it.
Hi @Manoj_Dokku4 ,
If you are wanting to delete ibas from a type definition then you can do this via load from file.
Actually if you load a type definition with less attributes than what already exists in the target Windchill, Windchill will create the lwcDeleteType and lwcDeleteAttributes loadFiles automatically. You can then choose to execute those loadFiles to do the deletion. This is Windchill's way of making sure nothing is deleted that isn't really intended to be.
This example deletes attributes from 3 types.
DefaultEPM, customPart, customDoc.
the first part of the <csvdefNames> is constant, followed by a comma separated list of ibas to remove, there should be plenty of examples for different data types in the example.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE NmLoader SYSTEM "standardX26.dtd">
<NmLoader>
<!-- EPM/CAD -->
<csvDeleteAttributes handler="com.ptc.core.lwc.server.TypeDefinitionLoader.deleteAttributeDefinitions">
<csvattTemplate>LWCTYPE</csvattTemplate>
<csvtypeContext>ext.customer.DefaultEPMDocument</csvtypeContext>
<csvdefNames>DATA|com.ptc.core.meta.common.DiscreteSet|DATA|java.lang.Boolean|false , DATA|java.lang.String|customShortDesc , DATA|java.lang.String|customGeomRestRe10 , DATA|java.lang.String|customIsGeomRestRRecE10 , DATA|java.lang.String|customScopeE10 , DATA|java.lang.String|customVoilRestrictE10 , DATA|java.lang.String|customIsDerived , DATA|java.lang.String|customIsVerified , DATA|java.lang.String|customIsInheritedDomain , DATA|java.lang.String|customShouldImport , DATA|java.sql.Timestamp|customCopyrightYear</csvdefNames>
</csvDeleteAttributes>
<!-- Document -->
<csvDeleteAttributes handler="com.ptc.core.lwc.server.TypeDefinitionLoader.deleteAttributeDefinitions">
<csvattTemplate>LWCTYPE</csvattTemplate>
<csvtypeContext>ext.customer.customDoc</csvtypeContext>
<csvdefNames>DATA|com.ptc.core.meta.common.DiscreteSet|DATA|java.lang.Boolean|false , DATA|java.lang.String|customShortDesc , DATA|java.sql.Timestamp|customCopyrightYear</csvdefNames>
</csvDeleteAttributes>
<!-- Part -->
<csvDeleteAttributes handler="com.ptc.core.lwc.server.TypeDefinitionLoader.deleteAttributeDefinitions">
<csvattTemplate>LWCTYPE</csvattTemplate>
<csvtypeContext>ext.customer.customPart</csvtypeContext>
<csvdefNames>DATA|com.ptc.core.meta.common.DiscreteSet|DATA|java.lang.Boolean|false , DATA|java.lang.String|customShortDesc , DATA|java.sql.Timestamp|customCopyrightYear</csvdefNames>
</csvDeleteAttributes>
</NmLoader>
to delete the attribute entirely from the Reusable Attributes Manager you could write a custom loader to achieve this or a standalone java utility to be executed from the windchill shell if you have shell access.
I would start looking at the OOTB DefinitionLoaderWithCache attribute loader if creating a custom loader.
Mind you that's not a supported API.
Hello @Manoj_Dokku4,
It looks like you have some responses from some community experts. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution.
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.
Thanks,
Vivek N.
Community Moderation Team.
