<?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] How to truncate in tMap variable expressions in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-truncate-in-tMap-variable-expressions/m-p/2312593#M83533</link>
    <description>This is not to do with nulls. You cannot have null as part of a String. Null is literally nothing. This is caused by the value you are trying to truncate not being 150 characters long. To get round this you can use something like below...&lt;BR /&gt;&lt;PRE&gt;row1.OOH_Type!=null &amp;amp;&amp;amp; row1.OOH_Type.length()&amp;gt;150 ? row1.OOH_Type.substring(0,150) : row1.OOH_Type &amp;nbsp;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;First we check to make sure the value is not null, then we check to see that the length is greater than 150 chars. If both are true, then we substring to get a 150 char String, otherwise we just return the original value.</description>
    <pubDate>Fri, 22 May 2015 01:12:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-05-22T01:12:50Z</dc:date>
    <item>
      <title>[resolved] How to truncate in tMap variable expressions</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-truncate-in-tMap-variable-expressions/m-p/2312592#M83532</link>
      <description>Hi there, 
&lt;BR /&gt;I want to truncate a string so that it is small enough to fit into an external DB from a Talend csv file output. What I have is the following: 
&lt;BR /&gt; 
&lt;PRE&gt;row1.OOH_Type.substring(0,150)&lt;/PRE&gt; 
&lt;BR /&gt;However, I get an index out of range error in the tmap component because I suspect that there are blank cell values which is throwing up null values that causes exceptions when I try to truncate a value. 
&lt;BR /&gt;Anyone know an expression I can write to take care of null values as well as truncate my string to the required size at the same time? 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;Facoda</description>
      <pubDate>Sat, 16 Nov 2024 11:12:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-truncate-in-tMap-variable-expressions/m-p/2312592#M83532</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T11:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to truncate in tMap variable expressions</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-truncate-in-tMap-variable-expressions/m-p/2312593#M83533</link>
      <description>This is not to do with nulls. You cannot have null as part of a String. Null is literally nothing. This is caused by the value you are trying to truncate not being 150 characters long. To get round this you can use something like below...&lt;BR /&gt;&lt;PRE&gt;row1.OOH_Type!=null &amp;amp;&amp;amp; row1.OOH_Type.length()&amp;gt;150 ? row1.OOH_Type.substring(0,150) : row1.OOH_Type &amp;nbsp;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;First we check to make sure the value is not null, then we check to see that the length is greater than 150 chars. If both are true, then we substring to get a 150 char String, otherwise we just return the original value.</description>
      <pubDate>Fri, 22 May 2015 01:12:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-truncate-in-tMap-variable-expressions/m-p/2312593#M83533</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-22T01:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to truncate in tMap variable expressions</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-truncate-in-tMap-variable-expressions/m-p/2312594#M83534</link>
      <description>This is sweet! Thanks rhall</description>
      <pubDate>Fri, 22 May 2015 11:27:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-truncate-in-tMap-variable-expressions/m-p/2312594#M83534</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-22T11:27:00Z</dc:date>
    </item>
  </channel>
</rss>

