Skip to main content
14-Alexandrite
December 8, 2022
Solved

Calculate an attribute onchange of another attribute

  • December 8, 2022
  • 1 reply
  • 2835 views

Hello,

 

I have a requirement where I have to populate an attribute if a specific value was selected for one of the other attributes. The user will not view the object after editing, so I cannot make of data utility and layout.

 

I know that we can use a data utility to record the onchange() event using comboBox and invoke a jsp file. But I am not sure what exactly to be done after invoking a method in jsp file since I want to invoke a java method which will do a set of validation and manipulation to calculate the attribute value.

 

Requesting all to shed some light on the possible solution.

 

Thanks,

Hari

Best answer by BjoernRueegg

If you would like to do it with calculated attributes, you can implement your own logic. Create a class and implement it with 

implements BusinessAlgorithm

see the development guide for an example https://support.ptc.com/help/wnc/r12.1.1.0/en/#page/Windchill_Help_Center/customization/WCCG_BusLogicCust_TypeManager_CalculatedAttribute.html

 

If you rather would like to store it as a value in the database, then you need to create a Pre Checkin trigger to set the attribute based on the other attribute values. 

 

 

 

1 reply

joe_morton
18-Opal
18-Opal
December 12, 2022

Have you looked into using calculated attributes? Might be a simpler approach.

 

Reference: https://www.ptc.com/en/support/article/cs41117

 

Sha1114-AlexandriteAuthor
14-Alexandrite
December 15, 2022

Hello @joe_morton ,

 

There are many validations that I need to perform and also establish DB connection for the calculation of the attribute, hence I do not think this requirement can be achieved through Calculated attribute functionality. Is it possible to invoke a custom java method through calculated attribute formula?