<?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: Get Long Attribute to int Attribute in Windchill Customization</title>
    <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/815010#M2703</link>
    <description>&lt;P&gt;I would suggest to get the long value and then get the integer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="lang-java s-code-block"&gt;&lt;CODE class="hljs language-java"&gt;com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(primaryBusinessObject,null,java.util.Locale.US,null);&lt;BR /&gt;obj.load("attribute");&lt;BR /&gt;long att1 = (long) obj.get("attribute")&lt;BR /&gt;int intValue = att1.intValue();&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Aug 2022 13:49:53 GMT</pubDate>
    <dc:creator>BjoernRueegg</dc:creator>
    <dc:date>2022-08-24T13:49:53Z</dc:date>
    <item>
      <title>Get Long Attribute to int Attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/814974#M2700</link>
      <description>&lt;P&gt;I can get a string attribute from the Change Activity to the workflow.&amp;nbsp; How do I convert a long attribute to an int attribute?&amp;nbsp; Code for string is below where attribute is the attribute in the change activity and att1 is the attribute in the workflow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(primaryBusinessObject,null,java.util.Locale.US,null);&lt;/P&gt;
&lt;P&gt;obj.load("attribute");&lt;/P&gt;
&lt;P&gt;att1 = (String) obj.get("attribute")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 14:07:59 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/814974#M2700</guid>
      <dc:creator>BrianToussaint</dc:creator>
      <dc:date>2024-03-15T14:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Get Long Attribute to int Attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/814991#M2701</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/26150"&gt;@BrianToussaint&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What error is shown in a log if the Long parameter is not converted to a int?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;does it really the java.lang.Long or is it different type as float,&amp;nbsp; double and so on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PetrH&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 13:26:24 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/814991#M2701</guid>
      <dc:creator>HelesicPetr</dc:creator>
      <dc:date>2022-08-24T13:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Get Long Attribute to int Attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/815007#M2702</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/26150"&gt;@BrianToussaint&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've checked some my workflows and I always use the .toString() operation.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;String tested_km = obj&lt;/SPAN&gt;.get&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"tested_km"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;.toString&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;After I get value I work with string even it is number, double, int, or whatever.&lt;/P&gt;
&lt;P&gt;It helps to avoid typeo errors in WF but also depends on the attribute type. Not all are eligible to use .getString().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PetrH&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 13:46:10 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/815007#M2702</guid>
      <dc:creator>HelesicPetr</dc:creator>
      <dc:date>2022-08-24T13:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Get Long Attribute to int Attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/815010#M2703</link>
      <description>&lt;P&gt;I would suggest to get the long value and then get the integer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="lang-java s-code-block"&gt;&lt;CODE class="hljs language-java"&gt;com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(primaryBusinessObject,null,java.util.Locale.US,null);&lt;BR /&gt;obj.load("attribute");&lt;BR /&gt;long att1 = (long) obj.get("attribute")&lt;BR /&gt;int intValue = att1.intValue();&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 13:49:53 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/815010#M2703</guid>
      <dc:creator>BjoernRueegg</dc:creator>
      <dc:date>2022-08-24T13:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get Long Attribute to int Attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/815699#M2704</link>
      <description>&lt;P&gt;Hi BrianToussaint,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to follow up with you on your &lt;A href="https://community.ptc.com/t5/Windchill/Get-Long-Attribute-to-int-Attribute/m-p/814991#M68026" target="_blank"&gt;post&lt;/A&gt; to see if your question has been answered.&lt;/P&gt;
&lt;P&gt;If so, please designate the appropriate post as the Accepted Solution for the benefit of other members who may have the same question.&lt;/P&gt;
&lt;P&gt;If not, please post your current status in the public thread so that we can continue to support.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Iuliana&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 08:14:35 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Get-Long-Attribute-to-int-Attribute/m-p/815699#M2704</guid>
      <dc:creator>Iuliana Nuta</dc:creator>
      <dc:date>2022-08-29T08:14:35Z</dc:date>
    </item>
  </channel>
</rss>

