<?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: Using if - else if - else in tMap in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353876#M119976</link>
    <description>&lt;P&gt;You can do this with an inline IF condition. As an example, if you have a condition like this....&lt;/P&gt;&lt;PRE&gt;if(myInValue==1){
      myOutValue = "a";
}else if(myInValue==2){
     myOutValue = "b";
}else if(myInValue==3){
     myOutValue = "c";
}else{
     myOutValue = "z";
}&lt;/PRE&gt;&lt;P&gt;....you would represent it like this as an in-line IF....&lt;/P&gt;&lt;PRE&gt;myOutValue = (myInValue==1 ? "a" : myInValue==2 ? "b" : myInValue==3 ? "c" : "z")  &lt;/PRE&gt;</description>
    <pubDate>Tue, 17 Jul 2018 10:07:23 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-07-17T10:07:23Z</dc:date>
    <item>
      <title>Using if - else if - else in tMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353875#M119975</link>
      <description>&lt;P&gt;DateTimeCreated&amp;nbsp; (String)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EnquiryUID&amp;nbsp; &amp;nbsp;(String)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ChannelId (Integer)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ClientId (Integer)&lt;/P&gt;
&lt;P&gt;20&lt;STRONG&gt;&lt;FONT color="#800080"&gt;18-07-16&lt;/FONT&gt;&lt;/STRONG&gt; 00:56:46&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#800080"&gt;037CA&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#000000"&gt;2&lt;/FONT&gt;E9-3860-4D45-9234-4894BC8F07FA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;229&lt;/P&gt;
&lt;P&gt;20&lt;STRONG&gt;&lt;FONT color="#800080"&gt;18-07-15&lt;/FONT&gt;&lt;/STRONG&gt; 23:48:00&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#800080"&gt;180715&lt;/FONT&gt;&lt;/STRONG&gt;8dc9a4a9047142ea8f06&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 296&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Requirements:&lt;/P&gt;
&lt;P&gt;case 1: If digits 2 to 8 of&amp;nbsp;&lt;SPAN&gt;DateTimeCreated&amp;nbsp; &lt;EM&gt;&lt;U&gt;match&lt;/U&gt;&lt;/EM&gt; digits 0 to 6 of&amp;nbsp;EnquiryUID&amp;nbsp; &amp;nbsp;and ChannelId is 229 or 296, then ClientId is 0&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;case 2: If digits&amp;nbsp;2 to 8 of&amp;nbsp;DateTimeCreated&amp;nbsp; &lt;U&gt;&lt;EM&gt;do not match&lt;/EM&gt;&lt;/U&gt; digits 0 to 6 of&amp;nbsp;EnquiryUID&amp;nbsp; &amp;nbsp;and ChannelId is 229 or 296, then ClientId is 9&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;case 3: else ClientId&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is the method in the routine&amp;nbsp;IsGTX_EnquiryUID&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;public static boolean isGTX (String dateTimeCreated, String EnquiryUID){&lt;BR /&gt;&lt;BR /&gt;String noSpacesDateTimeCreated = dateTimeCreated.replaceAll("\\D", "");&lt;BR /&gt;&lt;BR /&gt;String dateTimeCreatedChar2to8 = StringUtils.substring (noSpacesDateTimeCreated, 2, 8);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;String EnquiryUIDFirst6Char = StringUtils.substring(EnquiryUID, 0, 6);&lt;BR /&gt;&lt;BR /&gt;if (dateTimeCreatedChar2to8.equals(EnquiryUIDFirst6Char)) {&lt;BR /&gt;&lt;BR /&gt;return true;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;else {&lt;BR /&gt;&lt;BR /&gt;return false;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;What I did so far is using the trinary operator in tMap, but it only works on one condition.&lt;/P&gt;
&lt;P&gt;row1.ChannelId == 229?( IsGTX_EnquiryUID.isGTX(row1.dateTimeCreated,&amp;nbsp; row1.enquiryUID)?0 :9):row1.clientId;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tries to use if - else if - else in tMap, but it did not worked.&lt;/P&gt;
&lt;P&gt;How to do this for 3 different conditions in tMap?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am using Talend Data Management Platform v6.3.1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 16:16:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353875#M119975</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-16T16:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using if - else if - else in tMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353876#M119976</link>
      <description>&lt;P&gt;You can do this with an inline IF condition. As an example, if you have a condition like this....&lt;/P&gt;&lt;PRE&gt;if(myInValue==1){
      myOutValue = "a";
}else if(myInValue==2){
     myOutValue = "b";
}else if(myInValue==3){
     myOutValue = "c";
}else{
     myOutValue = "z";
}&lt;/PRE&gt;&lt;P&gt;....you would represent it like this as an in-line IF....&lt;/P&gt;&lt;PRE&gt;myOutValue = (myInValue==1 ? "a" : myInValue==2 ? "b" : myInValue==3 ? "c" : "z")  &lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Jul 2018 10:07:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353876#M119976</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-17T10:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using if - else if - else in tMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353877#M119977</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;My suggestion will be to use a tjavarow for complex row level if-else condition operations. Even though you can do the same logic in tmap, you may have to to think about the readability of the conditions also.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 16:43:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353877#M119977</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-17T16:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using if - else if - else in tMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353878#M119978</link>
      <description>&lt;P&gt;Hi &lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Your suggestion is good if I have one InValue, but the problem is that I have different requirements. You are suggesting:&lt;/P&gt; 
&lt;PRE&gt;myOutValue = (myInValue==1 ? "a" : myInValue==2 ? "b" : myInValue==3 ? "c" : "z")  &lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;I have two inValues&lt;/P&gt; 
&lt;P&gt;myOutValue = if (myInValueOne==1 ||&amp;nbsp;&lt;SPAN&gt;myInValueOne==2) and myInValueTwo ==3 ? "a":"b", else myOutValue;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 10:23:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353878#M119978</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-18T10:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using if - else if - else in tMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353879#M119979</link>
      <description>Thank you, I will check if possible to add a new component in the job.</description>
      <pubDate>Wed, 18 Jul 2018 10:24:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353879#M119979</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-18T10:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using if - else if - else in tMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353880#M119980</link>
      <description>&lt;PRE&gt;myOutValue = ((myInValueOne==1 || myInValueOne==2) &amp;amp;&amp;amp; myInValueTwo==3 ? "a" :"b")&lt;/PRE&gt;&lt;P&gt;Your pseudocode IF had an extra ELSE which would never be reached....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;if (myInValueOne==1 || myInValueOne==2) and myInValueTwo ==3 ? "a":"b", else myOutValue;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 10:59:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-if-else-if-else-in-tMap/m-p/2353880#M119980</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-18T10:59:36Z</dc:date>
    </item>
  </channel>
</rss>

