<?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: tMap - nested if else statement fails in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227704#M19224</link>
    <description>&lt;P&gt;If&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LLooAAG"&gt;@cterenzi&lt;/A&gt;'s suggestion does not work, can you show us the code where the error stack says the error occurred. It *could* be nothing to do with the code you have shown us. Trapping errors like this from a tMap generally require a quick flick through the code to see exactly where the error is occurring&lt;/P&gt;</description>
    <pubDate>Mon, 04 Nov 2019 18:55:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-11-04T18:55:54Z</dc:date>
    <item>
      <title>tMap - nested if else statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227700#M19220</link>
      <description>&lt;P&gt;Hi Everyone.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;This is my first post here so sorry if advance if I missed something and I go straight to the question.&lt;/P&gt; 
&lt;P&gt;Here is my issue.&lt;/P&gt; 
&lt;P&gt;I would like to populate integer data type field (output) from string data type (input).&lt;/P&gt; 
&lt;P&gt;But it looks like nested "if statement" doesn't work correctly.&lt;/P&gt; 
&lt;P&gt;This one expression doesn't work:&lt;/P&gt; 
&lt;P&gt;"&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="2"&gt;Relational.ISNULL(row3.DOB) || row3.DOB.trim().isEmpty() ? null : &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;(StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("jan") || StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("january")) ? 1 : &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;(StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("dec") || StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("december")) ? 12 : &lt;FONT size="5" color="#FF0000"&gt;null &lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;"&lt;/P&gt; 
&lt;P&gt;Every time I receive error message:&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="2"&gt;java.NullPointerException: null&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;But when I change my expression a little the job run with success (please look at the last else value (1 instead of null) &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;"&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="2"&gt;Relational.ISNULL(row3.DOB) || row3.DOB.trim().isEmpty() ? null : &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;(StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("jan") || StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("january")) ? 1 : &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;(StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("dec") || StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("december")) ? 12 : &lt;FONT size="5" color="#FF0000"&gt;1 &lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;"&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;My target column data type is nullable Integer.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;This is a little strange because for example there is no issue regarding the first null value in my expression:&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;"&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;&lt;FONT size="2"&gt;Relational.ISNULL(row3.DOB) || row3.DOB.trim().isEmpty() ? &lt;FONT size="5" color="#339966"&gt;null&lt;/FONT&gt; : &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;...&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;"&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;So to be honest I don't know what I'm doing wrong.&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;Can anyone help me?&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;Kind regards,&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="3"&gt;MSW&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:13:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227700#M19220</guid>
      <dc:creator>JackStrong</dc:creator>
      <dc:date>2024-11-16T04:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - nested if else statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227701#M19221</link>
      <description>&lt;P&gt;Can you take a screenshot of your tMap please? Also, this error *may* be misleading. Can you copy the complete error? Another thing that might help is to switch to the code tab and go to the line in the error stack where it says the error occurs. It will be to do the null you are producing at the end of this IF condition. I think somewhere downstream of this it is being used in an unsafe way or by a column that is not nullable.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 12:04:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227701#M19221</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-30T12:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - nested if else statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227702#M19222</link>
      <description>&lt;P&gt;Hi rhall_2_0.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Here is the screenshot and complete error message:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="2"&gt;Starting job IVRS_J010_4471_MK_7264_027_All at 15:27 04/11/2019.&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="2"&gt;[statistics] connecting to socket on port 3978&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;[statistics] connected&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;[FATAL]: talendetl.ivrs_j010_4471_mk_7264_027_all_0_1.IVRS_J010_4471_MK_7264_027_All - tMap_7 null&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;java.lang.NullPointerException&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;at talendetl.ivrs_j010_4471_mk_7264_027_all_0_1.IVRS_J010_4471_MK_7264_027_All.tDBInput_3Process(IVRS_J010_4471_MK_7264_027_All.java:9391)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;at talendetl.ivrs_j010_4471_mk_7264_027_all_0_1.IVRS_J010_4471_MK_7264_027_All.tFileInputExcel_1Process(IVRS_J010_4471_MK_7264_027_All.java:3841)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;at talendetl.ivrs_j010_4471_mk_7264_027_all_0_1.IVRS_J010_4471_MK_7264_027_All.runJobInTOS(IVRS_J010_4471_MK_7264_027_All.java:14202)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;at talendetl.ivrs_j010_4471_mk_7264_027_all_0_1.IVRS_J010_4471_MK_7264_027_All.main(IVRS_J010_4471_MK_7264_027_All.java:13794)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Exception in component tMap_7 (IVRS_J010_4471_MK_7264_027_All)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;java.lang.NullPointerException&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;at talendetl.ivrs_j010_4471_mk_7264_027_all_0_1.IVRS_J010_4471_MK_7264_027_All.tDBInput_3Process(IVRS_J010_4471_MK_7264_027_All.java:9391)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;at talendetl.ivrs_j010_4471_mk_7264_027_all_0_1.IVRS_J010_4471_MK_7264_027_All.tFileInputExcel_1Process(IVRS_J010_4471_MK_7264_027_All.java:3841)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;at talendetl.ivrs_j010_4471_mk_7264_027_all_0_1.IVRS_J010_4471_MK_7264_027_All.runJobInTOS(IVRS_J010_4471_MK_7264_027_All.java:14202)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;at talendetl.ivrs_j010_4471_mk_7264_027_all_0_1.IVRS_J010_4471_MK_7264_027_All.main(IVRS_J010_4471_MK_7264_027_All.java:13794)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;[statistics] disconnected&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="2"&gt;Job IVRS_J010_4471_MK_7264_027_All ended at 15:27 04/11/2019. [exit code=1]&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I checked the code tab and from my perspective there is nothing what can cause the error but I'm not the Java guru.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LwSZ"&gt;tMap_20191104.jpg&lt;/A&gt;</description>
      <pubDate>Mon, 04 Nov 2019 15:49:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227702#M19222</guid>
      <dc:creator>JackStrong</dc:creator>
      <dc:date>2019-11-04T15:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - nested if else statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227703#M19223</link>
      <description>&lt;P&gt;Java can be tricky when you ask it to box and unbox values.&amp;nbsp; I'm not sure of the specific operations in play, but it may be trying to unbox the last null in your code before boxing up the result into the Integer that becomes the expression output.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I was able to avoid this by casting your two literal outputs to Integer like so:&lt;/P&gt; 
&lt;PRE&gt;Relational.ISNULL(row3.DOB) || row3.DOB.trim().isEmpty() ? null :
(
(StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("jan") || StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("january")) ? (Integer)1 :
(StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("dec") || StringHandling.DOWNCASE(StringHandling.LEFT(StringHandling.TRIM(row3.DOB),StringHandling.INDEX(StringHandling.TRIM(row3.DOB),", "))).equals("december")) ? (Integer)12 : null
) &lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Nov 2019 18:44:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227703#M19223</guid>
      <dc:creator>cterenzi</dc:creator>
      <dc:date>2019-11-04T18:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - nested if else statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227704#M19224</link>
      <description>&lt;P&gt;If&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LLooAAG"&gt;@cterenzi&lt;/A&gt;'s suggestion does not work, can you show us the code where the error stack says the error occurred. It *could* be nothing to do with the code you have shown us. Trapping errors like this from a tMap generally require a quick flick through the code to see exactly where the error is occurring&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 18:55:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227704#M19224</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-11-04T18:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - nested if else statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227705#M19225</link>
      <description>&lt;P&gt;Hi cterenzi.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Ten-Stars lia-component-message-view-widget-author-username"&gt;&lt;SPAN class=""&gt;Your tip is fine in my case. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Ten-Stars lia-component-message-view-widget-author-username"&gt;&lt;SPAN class=""&gt;Now Talend doesn't trow any error.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Ten-Stars lia-component-message-view-widget-author-username"&gt;&lt;SPAN class=""&gt;Thanks for that &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;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Ten-Stars lia-component-message-view-widget-author-username"&gt;&lt;SPAN class=""&gt;Regards.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 09:46:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-nested-if-else-statement-fails/m-p/2227705#M19225</guid>
      <dc:creator>JackStrong</dc:creator>
      <dc:date>2019-11-05T09:46:47Z</dc:date>
    </item>
  </channel>
</rss>

