<?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] tmap convert string to char in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-tmap-convert-string-to-char/m-p/2243513#M29969</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Hi,&lt;BR /&gt;looks like you're getting tripped up on a bit of subtle java syntax.&lt;BR /&gt;to get it to do what you want, you'll need to use the "&amp;lt;String&amp;gt;.equals()" String method instead of "==".&amp;nbsp;&lt;BR /&gt;Java uses "==" to compare object references, not to check if the contents are the same.&amp;nbsp;&lt;BR /&gt;give this a try in your tMap:&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;"X".equals(row1.name) ? 1 : 0&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Thank you, it works!&amp;nbsp;&lt;BR /&gt;I tried that but i did row1.name.equals("X")?1:0 and i had a null error</description>
    <pubDate>Tue, 27 Jan 2015 08:52:49 GMT</pubDate>
    <dc:creator>Jcs19</dc:creator>
    <dc:date>2015-01-27T08:52:49Z</dc:date>
    <item>
      <title>[resolved] tmap convert string to char</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-tmap-convert-string-to-char/m-p/2243510#M29966</link>
      <description>Hello Talend, 
&lt;BR /&gt; 
&lt;BR /&gt;I'm trying to convert a string "X" to a character 'x' in tMap 
&lt;BR /&gt;Actually my problem is that when i tried to do (row1.name == "X")?1:0 Talend never reconize "X" and always return 0 whereas there are X in my data. 
&lt;BR /&gt;Thats wierd, maybe its because my string contains only 1 character ! 
&lt;BR /&gt;That's why I want to try row1.name == 'X' 
&lt;BR /&gt;My Data :&amp;nbsp; 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/180419/teteadsa.png" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCY7.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/139791i5E78433010446228/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCY7.png" alt="0683p000009MCY7.png" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt;My tMap 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/180419/temp.png" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCdL.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128357iA08EFEF24A1D8F63/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCdL.png" alt="0683p000009MCdL.png" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt;MS_op is string 
&lt;BR /&gt;test is integer 
&lt;BR /&gt;I also tried to trim and left(row1.name,1) 
&lt;BR /&gt; 
&lt;BR /&gt;My output 
&lt;BR /&gt;&amp;nbsp; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/180419/asdads.png" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCEI.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/152372i1449B5503B60DD82/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCEI.png" alt="0683p000009MCEI.png" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Expected output&amp;nbsp; 
&lt;BR /&gt;X ¦ 1 
&lt;BR /&gt;X ¦ 1 
&lt;BR /&gt;¦ 0 
&lt;BR /&gt;¦ 0 
&lt;BR /&gt;what's wrong !? HALP !!</description>
      <pubDate>Mon, 26 Jan 2015 14:48:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-tmap-convert-string-to-char/m-p/2243510#M29966</guid>
      <dc:creator>Jcs19</dc:creator>
      <dc:date>2015-01-26T14:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] tmap convert string to char</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-tmap-convert-string-to-char/m-p/2243511#M29967</link>
      <description>I found a workaround by doing&amp;nbsp;&lt;BR /&gt;(row1.name==null)?0:1&lt;BR /&gt;but i really want if row1.name = "X" then 1 else 0</description>
      <pubDate>Mon, 26 Jan 2015 16:41:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-tmap-convert-string-to-char/m-p/2243511#M29967</guid>
      <dc:creator>Jcs19</dc:creator>
      <dc:date>2015-01-26T16:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] tmap convert string to char</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-tmap-convert-string-to-char/m-p/2243512#M29968</link>
      <description>Hi,&lt;BR /&gt;looks like you're getting tripped up on a bit of subtle java syntax.&lt;BR /&gt;to get it to do what you want, you'll need to use the "&amp;lt;String&amp;gt;.equals()" String method instead of "==".&amp;nbsp;&lt;BR /&gt;Java uses "==" to compare object references, not to check if the contents are the same.&amp;nbsp;&lt;BR /&gt;give this a try in your tMap:&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;"X".equals(row1.name) ? 1 : 0&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Jan 2015 19:39:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-tmap-convert-string-to-char/m-p/2243512#M29968</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-26T19:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] tmap convert string to char</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-tmap-convert-string-to-char/m-p/2243513#M29969</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Hi,&lt;BR /&gt;looks like you're getting tripped up on a bit of subtle java syntax.&lt;BR /&gt;to get it to do what you want, you'll need to use the "&amp;lt;String&amp;gt;.equals()" String method instead of "==".&amp;nbsp;&lt;BR /&gt;Java uses "==" to compare object references, not to check if the contents are the same.&amp;nbsp;&lt;BR /&gt;give this a try in your tMap:&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;"X".equals(row1.name) ? 1 : 0&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Thank you, it works!&amp;nbsp;&lt;BR /&gt;I tried that but i did row1.name.equals("X")?1:0 and i had a null error</description>
      <pubDate>Tue, 27 Jan 2015 08:52:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-tmap-convert-string-to-char/m-p/2243513#M29969</guid>
      <dc:creator>Jcs19</dc:creator>
      <dc:date>2015-01-27T08:52:49Z</dc:date>
    </item>
  </channel>
</rss>

