<?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: [resolved] String to Big-Decimal conversion in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-String-to-Big-Decimal-conversion/m-p/2219035#M13992</link>
    <description>I've tried using the expression below in the variable port of a tMap: 
&lt;BR /&gt;new BigDecimal((row1.field1.toString() != null ? row1.field1 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MPcz.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157233iD1A564EF62DE3BC2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MPcz.png" alt="0683p000009MPcz.png" /&gt;&lt;/span&gt;row1.field2.toString() != null ? row1.field2 : 1))) 
&lt;BR /&gt;But I get Java exception errors while testing the expression. Please note that both field1 and field are of BigDecimal datatype and I need to check if they are null.</description>
    <pubDate>Tue, 01 Dec 2015 07:11:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-12-01T07:11:16Z</dc:date>
    <item>
      <title>[resolved] String to Big-Decimal conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-String-to-Big-Decimal-conversion/m-p/2219033#M13990</link>
      <description>Hi All,&lt;BR /&gt;I have the situation where I need to convert the String result returned by&amp;nbsp;an if-else block in Talend that I need to convert into bigdecimal. I have tried out the &amp;nbsp;below two options and none of them seem to be working&lt;BR /&gt;Option 1:&lt;BR /&gt;(BigDecimal) ( Col1="ABC" ? Col2 : Col3)&lt;BR /&gt;Option 2:&lt;BR /&gt;(new BigDecimal(Col1="ABC" ? Col2:Col3))&lt;BR /&gt;In this case both Col2 and Col3 are variables of string datatype in tmap.&lt;BR /&gt;Please share your suggestion on whether its possible to get this type of a conversion done.</description>
      <pubDate>Mon, 30 Nov 2015 17:48:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-String-to-Big-Decimal-conversion/m-p/2219033#M13990</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-30T17:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] String to Big-Decimal conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-String-to-Big-Decimal-conversion/m-p/2219034#M13991</link>
      <description>You are missing your row names from your "Col" names. You are also not checking for equality correctly. Assuming your row names are "row1", your code should look something like below...
&lt;BR /&gt;new BigDecimal((row1.Col1.compareTo("ABC")==0 ? row1.Col2 : row1.Col3))
&lt;BR /&gt;The in-line IF is contained inside brackets. This just aids readability.&amp;nbsp;</description>
      <pubDate>Mon, 30 Nov 2015 23:52:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-String-to-Big-Decimal-conversion/m-p/2219034#M13991</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-30T23:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] String to Big-Decimal conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-String-to-Big-Decimal-conversion/m-p/2219035#M13992</link>
      <description>I've tried using the expression below in the variable port of a tMap: 
&lt;BR /&gt;new BigDecimal((row1.field1.toString() != null ? row1.field1 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MPcz.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157233iD1A564EF62DE3BC2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MPcz.png" alt="0683p000009MPcz.png" /&gt;&lt;/span&gt;row1.field2.toString() != null ? row1.field2 : 1))) 
&lt;BR /&gt;But I get Java exception errors while testing the expression. Please note that both field1 and field are of BigDecimal datatype and I need to check if they are null.</description>
      <pubDate>Tue, 01 Dec 2015 07:11:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-String-to-Big-Decimal-conversion/m-p/2219035#M13992</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-01T07:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] String to Big-Decimal conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-String-to-Big-Decimal-conversion/m-p/2219036#M13993</link>
      <description>If field1 and field2 are BigDecimals, then you don't need to create a new one unless you are creating one for the "1" at the end.&lt;BR /&gt;The error you are getting is probably a nullpointerexception because you cannot use methods from a null object. You are trying to use ".toString()". If the object is null, you will get the nullpointerexception.&lt;BR /&gt;Why not use.....&lt;BR /&gt;row1.field1!=null ? row1.field1 : row1.field2!=null ? row1.field2 : new BigDecimal(1)</description>
      <pubDate>Tue, 01 Dec 2015 09:08:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-String-to-Big-Decimal-conversion/m-p/2219036#M13993</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-01T09:08:34Z</dc:date>
    </item>
  </channel>
</rss>

