<?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: Multiply 2 BigDecimal - java error in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Multiply-2-BigDecimal-java-error/m-p/2264298#M44182</link>
    <description>You have to keep in mind that Talend generates Java code and there is a requirement (particularly in Expressions) to use Java. The problem you are having here is because BigDecimal mathematics are not as simple as they are with other numeric types. This should help you.....
&lt;BR /&gt;
&lt;A href="http://www.opentaps.org/docs/index.php/How_to_Use_Java_BigDecimal:_A_Tutorial" rel="nofollow noopener noreferrer"&gt;http://www.opentaps.org/docs/index.php/How_to_Use_Java_BigDecimal:_A_Tutorial&lt;/A&gt;</description>
    <pubDate>Fri, 13 Nov 2015 10:27:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-11-13T10:27:54Z</dc:date>
    <item>
      <title>Multiply 2 BigDecimal - java error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Multiply-2-BigDecimal-java-error/m-p/2264297#M44181</link>
      <description>Hi everyone, 
&lt;BR /&gt; 
&lt;BR /&gt;In MySQL DB the field&amp;nbsp; 
&lt;B&gt;row8.purchasing_price&lt;/B&gt;&amp;nbsp;is recorded as DECIMAL(16,2) 
&lt;BR /&gt;In MySQL DB the field&amp;nbsp; 
&lt;B&gt;row10.php_to_myr&amp;nbsp;&lt;/B&gt;is recorded as DECIMAL(16,6) 
&lt;BR /&gt;In Talend (in the tMap) the field&amp;nbsp; 
&lt;B&gt;row8.purchasing_price&lt;/B&gt;&amp;nbsp;is recognized as a float and I set manually the type as BigDecimal 
&lt;BR /&gt;In Talend (in the tMap) the field&amp;nbsp; 
&lt;B&gt;row10.php_to_myr&amp;nbsp;&lt;/B&gt;is recognized as a float and I set manually the type as BigDecimal 
&lt;BR /&gt; 
&lt;BR /&gt;Theses codes below raise an error (cf. screenshot below) 
&lt;BR /&gt;code 1 
&lt;BR /&gt; 
&lt;PRE&gt;row8.purchasing_price_currency.equals("PHP")&lt;BR /&gt;?row8.purchasing_price*row10.php_to_myr&lt;BR /&gt;:System.out.println("ERROR purchasing price")&lt;/PRE&gt; 
&lt;BR /&gt;code 2 
&lt;BR /&gt; 
&lt;PRE&gt;row8.purchasing_price_currency.equals("PHP")&lt;BR /&gt;?row8.purchasing_price.multiply(BigDecimal.valueOf(row10.php_to_myr))&lt;BR /&gt;:System.out.println("ERROR purchasing price")&lt;/PRE&gt; 
&lt;BR /&gt;What can I do to multiply 2 BigDecimal (or float) ? 
&lt;BR /&gt;Thank you for your advice. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCA3.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/150520i981E83A6DD96696F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCA3.png" alt="0683p000009MCA3.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCJk.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/129103i3A4A41A5D2F7888A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCJk.png" alt="0683p000009MCJk.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Fri, 13 Nov 2015 08:57:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Multiply-2-BigDecimal-java-error/m-p/2264297#M44181</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-13T08:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Multiply 2 BigDecimal - java error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Multiply-2-BigDecimal-java-error/m-p/2264298#M44182</link>
      <description>You have to keep in mind that Talend generates Java code and there is a requirement (particularly in Expressions) to use Java. The problem you are having here is because BigDecimal mathematics are not as simple as they are with other numeric types. This should help you.....
&lt;BR /&gt;
&lt;A href="http://www.opentaps.org/docs/index.php/How_to_Use_Java_BigDecimal:_A_Tutorial" rel="nofollow noopener noreferrer"&gt;http://www.opentaps.org/docs/index.php/How_to_Use_Java_BigDecimal:_A_Tutorial&lt;/A&gt;</description>
      <pubDate>Fri, 13 Nov 2015 10:27:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Multiply-2-BigDecimal-java-error/m-p/2264298#M44182</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-13T10:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Multiply 2 BigDecimal - java error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Multiply-2-BigDecimal-java-error/m-p/2264299#M44183</link>
      <description>Hi again rhall_2.0, 
&lt;BR /&gt;The tutorial is quiet good to understand why you can face some precision issue. 
&lt;BR /&gt;But in my case, I don't have any precision troubles since my code is not even able to get me a result 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;I am going to try to work with float since Talend recognized my DECIMAL fields (in MySQL DB) as FLOAT (in tMap) by default. 
&lt;BR /&gt;Thx.</description>
      <pubDate>Fri, 13 Nov 2015 10:47:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Multiply-2-BigDecimal-java-error/m-p/2264299#M44183</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-13T10:47:45Z</dc:date>
    </item>
  </channel>
</rss>

