<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calculate an attribute onchange of another attribute in Windchill Customization</title>
    <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844620#M2542</link>
    <description>&lt;P&gt;I have done it in the same way, but where I am confused is why the obj.load() line is giving an exception. The attribute that I am trying to load is associated with the object but still some exception is getting triggered.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Dec 2022 09:45:00 GMT</pubDate>
    <dc:creator>Sha11</dc:creator>
    <dc:date>2022-12-16T09:45:00Z</dc:date>
    <item>
      <title>Calculate an attribute onchange of another attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/842853#M2536</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Requesting all to shed some light on the possible solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hari&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 14:04:38 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/842853#M2536</guid>
      <dc:creator>Sha11</dc:creator>
      <dc:date>2024-03-15T14:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate an attribute onchange of another attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/843493#M2537</link>
      <description>&lt;P&gt;Have you looked into using calculated attributes? Might be a simpler approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reference:&amp;nbsp;&lt;A href="https://www.ptc.com/en/support/article/cs41117" target="_blank"&gt;https://www.ptc.com/en/support/article/cs41117&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 15:43:44 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/843493#M2537</guid>
      <dc:creator>joe_morton</dc:creator>
      <dc:date>2022-12-12T15:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate an attribute onchange of another attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844327#M2538</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/205842"&gt;@joe_morton&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 08:34:59 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844327#M2538</guid>
      <dc:creator>Sha11</dc:creator>
      <dc:date>2022-12-15T08:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate an attribute onchange of another attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844385#M2539</link>
      <description>&lt;P&gt;If you would like to do it with calculated attributes, you can implement your own logic. Create a class and implement it with&amp;nbsp;&lt;/P&gt;
&lt;DIV class="page" title="Page 1384"&gt;
&lt;DIV class="layoutArea"&gt;
&lt;DIV class="column"&gt;&lt;LI-CODE lang="java"&gt;implements BusinessAlgorithm&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;see the development guide for an example&amp;nbsp;&lt;A href="https://support.ptc.com/help/wnc/r12.1.1.0/en/#page/Windchill_Help_Center/customization/WCCG_BusLogicCust_TypeManager_CalculatedAttribute.html" target="_blank"&gt;https://support.ptc.com/help/wnc/r12.1.1.0/en/#page/Windchill_Help_Center/customization/WCCG_BusLogicCust_TypeManager_CalculatedAttribute.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Dec 2022 12:40:28 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844385#M2539</guid>
      <dc:creator>BjoernRueegg</dc:creator>
      <dc:date>2022-12-15T12:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate an attribute onchange of another attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844603#M2540</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/224791"&gt;@BjoernRueegg&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your suggestion, I have implemented the calculated attribute functionality and its almost working as expected. I am facing one issue in a use case, I want this new attribute to be calculated when its null or blank, if the calculated attribute has a value, new value is not needed to be calculated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote this value check logic using persistable adapter as shown below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PersistableAdapter obj = new PersistableAdapter(data, null, SessionHelper.getLocale(), new UpdateOperationIdentifier());&lt;/P&gt;&lt;P&gt;obj.load("calculatedAttribute");&lt;BR /&gt;&lt;BR /&gt;String testNumber = (String) obj.get("calculatedAttribute");&lt;BR /&gt;&lt;BR /&gt;if(testNumber==null || StringUtils.isBlank(testNumber)) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;//method to calculate the attribute value&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Somehow an exception is being thrown in the obj.load() line, do you have any suggestion as to how we can easily determine if the value is null or not before or after invoking the execute method of business algorithm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PFA log file with exception stack trace.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 07:48:21 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844603#M2540</guid>
      <dc:creator>Sha11</dc:creator>
      <dc:date>2022-12-16T07:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate an attribute onchange of another attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844618#M2541</link>
      <description>&lt;P&gt;You can call the obj.load inside a try{} and then handle the exceptions in a catch{}, that’s the way I’ve been doing it so I hope it’s right&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 09:42:13 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844618#M2541</guid>
      <dc:creator>rhart</dc:creator>
      <dc:date>2022-12-16T09:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate an attribute onchange of another attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844620#M2542</link>
      <description>&lt;P&gt;I have done it in the same way, but where I am confused is why the obj.load() line is giving an exception. The attribute that I am trying to load is associated with the object but still some exception is getting triggered.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 09:45:00 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844620#M2542</guid>
      <dc:creator>Sha11</dc:creator>
      <dc:date>2022-12-16T09:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate an attribute onchange of another attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844621#M2543</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Why are you loading the Persistable Adapter with the UpdateOperationIdentifier? Please change that one to:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;PersistableAdapter obj = new PersistableAdapter(object, null, SessionHelper.getLocale(), new DisplayOperationIdentifier());&lt;/LI-CODE&gt;
&lt;P&gt;Could it be, that this attribute is not on the edit layout?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 10:41:09 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Calculate-an-attribute-onchange-of-another-attribute/m-p/844621#M2543</guid>
      <dc:creator>BjoernRueegg</dc:creator>
      <dc:date>2022-12-16T10:41:09Z</dc:date>
    </item>
  </channel>
</rss>

