<?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 If else statement throwing error in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/If-else-statement-throwing-error/m-p/2232693#M22575</link>
    <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to achieve if else statement in tMap as follows. Using 5.6.1 talend version&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Condition 1. If status = P then print the following values MOD,STK,ALG&lt;/P&gt;
&lt;P&gt;(Sub Condition is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF ALG is not null then print ALG then ignore ALG field completely.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expected output&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if STATUS =p and ALG is not null&lt;/P&gt;
&lt;P&gt;MOD=Sample_module;STK=Sample_stk;ALG=test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if STATUS =p and ALG is null&lt;/P&gt;
&lt;P&gt;MOD=Sample_module;STK=Sample_stk&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if STATUS not equal to p then blank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(STATUS ).equals("P")?&lt;BR /&gt;("MOD="+"Sample_module;"+ ";STK="+"Sample_stk;"+&lt;BR /&gt;((ALG != null)? ("ALG="+ ALG):--false): " "&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help to achieve this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jun 2020 12:45:48 GMT</pubDate>
    <dc:creator>Vicky2</dc:creator>
    <dc:date>2020-06-24T12:45:48Z</dc:date>
    <item>
      <title>If else statement throwing error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/If-else-statement-throwing-error/m-p/2232693#M22575</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to achieve if else statement in tMap as follows. Using 5.6.1 talend version&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Condition 1. If status = P then print the following values MOD,STK,ALG&lt;/P&gt;
&lt;P&gt;(Sub Condition is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF ALG is not null then print ALG then ignore ALG field completely.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expected output&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if STATUS =p and ALG is not null&lt;/P&gt;
&lt;P&gt;MOD=Sample_module;STK=Sample_stk;ALG=test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if STATUS =p and ALG is null&lt;/P&gt;
&lt;P&gt;MOD=Sample_module;STK=Sample_stk&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if STATUS not equal to p then blank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(STATUS ).equals("P")?&lt;BR /&gt;("MOD="+"Sample_module;"+ ";STK="+"Sample_stk;"+&lt;BR /&gt;((ALG != null)? ("ALG="+ ALG):--false): " "&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help to achieve this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 12:45:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/If-else-statement-throwing-error/m-p/2232693#M22575</guid>
      <dc:creator>Vicky2</dc:creator>
      <dc:date>2020-06-24T12:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: If else statement throwing error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/If-else-statement-throwing-error/m-p/2232694#M22576</link>
      <description>&lt;P&gt;Based on your screen capture,&amp;nbsp;as you're using a ternary condition, you need the "else" part.&lt;/P&gt;
&lt;P&gt;General syntax is "&lt;FONT face="courier new,courier"&gt;your_condition &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;?&lt;/STRONG&gt;&lt;/FONT&gt; then_part_expression &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;:&lt;/STRONG&gt;&lt;/FONT&gt; else_part_expression&lt;/FONT&gt;"&lt;/P&gt;
&lt;P&gt;Also, at runtime&amp;nbsp;a possible cause of null pointer exception is row2.STATUS is null.&lt;/P&gt;
&lt;P&gt;So, start the condition with &lt;FONT face="courier new,courier"&gt;"P".equals(row2.STATUS) ? ...&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 13:07:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/If-else-statement-throwing-error/m-p/2232694#M22576</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2020-06-24T13:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: If else statement throwing error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/If-else-statement-throwing-error/m-p/2232695#M22577</link>
      <description>&lt;P&gt;Thanks TRF,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any other alternative way to achieve this without using the ternary operator. As in my requirement , I don't have the else part.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If condition is not matching then the field should not be printed completely. So only If condition should be there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 13:22:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/If-else-statement-throwing-error/m-p/2232695#M22577</guid>
      <dc:creator>Vicky2</dc:creator>
      <dc:date>2020-06-24T13:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: If else statement throwing error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/If-else-statement-throwing-error/m-p/2232696#M22578</link>
      <description>Into a tMap, ternary condition is the best way. Having an empty "else part" is authorized (cond ? "A" : " ").
&lt;BR /&gt;This one is maybe not so far of what you expect:
&lt;BR /&gt;("P" ).equals(row2.STATUS) ? "MOD= Sample_module;;STK=Sample_stk;" +
&lt;BR /&gt;((row2.ALG != null) ? ("ALG="+ row2.ALG) : "") : ""</description>
      <pubDate>Wed, 24 Jun 2020 13:38:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/If-else-statement-throwing-error/m-p/2232696#M22578</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2020-06-24T13:38:56Z</dc:date>
    </item>
  </channel>
</rss>

