cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Translate the entire conversation x

Is there any Available Code to Delete Global Attribute from Softtype?

Manoj_Dokku4
14-Alexandrite

Is there any Available Code to Delete Global Attribute from Softtype?

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.

  1. SoftType
  2. Manage Reusable Attributes.
7 REPLIES 7
Fadel
22-Sapphire III
(To:Manoj_Dokku4)

HelesicPetr
22-Sapphire II
(To:Fadel)

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.

HelesicPetr_0-1761124950789.png

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

 

@Manoj_Dokku4 

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.

Manoj_Dokku4
14-Alexandrite
(To:d_graham)

@d_graham , Can you please provide me info regarding any API I can try?

@Manoj_Dokku4 ,

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.

Announcements
Top Tags