<?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 - IF ELSE statement fails in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248119#M33078</link>
    <description>&lt;P&gt;Yes, I've tried this sentence, the problem is that not always will be a number, here's an example on which it's "/2":&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-07-24 16_48_07-frit.txt_ Bloc de notas.png" style="width: 286px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6Iv.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154543iC9A446D84A6E92AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6Iv.png" alt="0683p000009M6Iv.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2019 15:50:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-07-24T15:50:38Z</dc:date>
    <item>
      <title>tMap - IF ELSE statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248115#M33074</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I have this table and I'm trying to apply a conditional statement to get a boolean to find out if the 5th position of the field DATE is char "/"&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura.PNG" style="width: 543px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6lw.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157440iF714FCA7DF29345D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6lw.png" alt="0683p000009M6lw.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I've made it in two steps, first I've applied this statement to get the "/" from the 5th position:&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;StringHandling.RIGHT(StringHandling.LEFT(row1.DATE,5),1)&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;That works, but when I add the contitional expression, It doesn't work and all I got are 0:&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;StringHandling.RIGHT(StringHandling.LEFT(row1.DATE,5),1) == "/" ? 1:0&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Could someone help me, please?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thank you!!&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:10:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248115#M33074</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T05:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - IF ELSE statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248116#M33075</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;== is an operator comparing objects in your example, not their content!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Comparing strings can be made with the .equals() method of the String object :&lt;/P&gt;
&lt;PRE&gt;"/".equals(StringHandling.RIGHT(StringHandling.LEFT(row1.DATE,5),1))?1:0&lt;/PRE&gt;
&lt;P&gt;Or with the .equals method of the Objects object (you may have to import it first) :&lt;/P&gt;
&lt;PRE&gt;Objects.equals("/", StringHandling.RIGHT(StringHandling.LEFT(row1.DATE,5),1))?1:0&lt;/PRE&gt;
&lt;P&gt;You can also use other methods depending on your needs (.compareTo() for example)&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 12:16:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248116#M33075</guid>
      <dc:creator>lennelei</dc:creator>
      <dc:date>2019-07-24T12:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - IF ELSE statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248117#M33076</link>
      <description>&lt;P&gt;Thank you!!&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;By the way, now I'm trying to apply the same rule to determine if the 5th and 6th characters are smaller than 12.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;&amp;lt;= 12&lt;/STRONG&gt; (StringHandling.RIGHT(StringHandling.LEFT(row1.DATE,7),2)) ?1:0&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Could you please tell me which would be the correct sentence?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 15:21:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248117#M33076</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-24T15:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - IF ELSE statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248118#M33077</link>
      <description>&lt;P&gt;if &lt;SPAN&gt;&lt;EM&gt;(StringHandling.RIGHT(StringHandling.LEFT(row1.DATE,7),2))&lt;/EM&gt;&amp;nbsp;&lt;/SPAN&gt;returns the correct part of the String, and you are sure it will be a number, you may do&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;Integer.parseInt(StringHandling.RIGHT(StringHandling.LEFT(row1.DATE,7),2))) &amp;lt;= 12&lt;/PRE&gt; 
&lt;P&gt;In this case, you can use &amp;lt;= as you are comparing an int &lt;SPAN&gt;primitive&amp;nbsp;&lt;/SPAN&gt;with the value 12&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 15:32:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248118#M33077</guid>
      <dc:creator>lennelei</dc:creator>
      <dc:date>2019-07-24T15:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - IF ELSE statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248119#M33078</link>
      <description>&lt;P&gt;Yes, I've tried this sentence, the problem is that not always will be a number, here's an example on which it's "/2":&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-07-24 16_48_07-frit.txt_ Bloc de notas.png" style="width: 286px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6Iv.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154543iC9A446D84A6E92AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6Iv.png" alt="0683p000009M6Iv.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 15:50:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248119#M33078</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-24T15:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - IF ELSE statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248120#M33079</link>
      <description>&lt;P&gt;Then you should test the value before:&lt;/P&gt; 
&lt;P&gt;First add a tMap variable testValue with this code :&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;Integer.parseInt(StringHandling.RIGHT(StringHandling.LEFT(row1.DATE,7),2)))&lt;/PRE&gt; 
&lt;P&gt;And then use this in your test:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;Var.testValue.matches([0-9]+)?Integer.parseInt(Var.testValue)&amp;lt;=12:false&lt;/PRE&gt; 
&lt;P&gt;This will test if your substring contains only digits. If yes, this will return if that number is less or equal than 12. If no, this will return false.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 15:59:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248120#M33079</guid>
      <dc:creator>lennelei</dc:creator>
      <dc:date>2019-07-24T15:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - IF ELSE statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248121#M33080</link>
      <description>&lt;P&gt;I've tried adding the testValue and then executing this sentence:&lt;/P&gt; 
&lt;PRE&gt;Var.testValue.matches([0-9]+)?Integer.parseInt(Var.testValue)&amp;lt;=12:false&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;And I have this error:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M69T.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149017i37E6A7D769D32EFC/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M69T.png" alt="0683p000009M69T.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="aaa.png" style="width: 403px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6K2.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/141445iB0D3D58019F35B93/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6K2.png" alt="0683p000009M6K2.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thank you for your time&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 16:37:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248121#M33080</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-24T16:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: tMap - IF ELSE statement fails</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248122#M33081</link>
      <description>&lt;P&gt;Of course, I forgot to quote the regex &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;&lt;/P&gt; 
&lt;PRE&gt;Var.testValue.matches("[0-9]+")?Integer.parseInt(Var.testValue)&amp;lt;=12:false&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jul 2019 16:50:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMap-IF-ELSE-statement-fails/m-p/2248122#M33081</guid>
      <dc:creator>lennelei</dc:creator>
      <dc:date>2019-07-24T16:50:46Z</dc:date>
    </item>
  </channel>
</rss>

