<?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] Error substring : index out of range in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201993#M3874</link>
    <description>Thanks, Shong! 
&lt;BR /&gt;This worked perfectly!</description>
    <pubDate>Tue, 01 Dec 2009 14:37:10 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-12-01T14:37:10Z</dc:date>
    <item>
      <title>[resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201985#M3866</link>
      <description>Hello, 
&lt;BR /&gt;I have a problem concerning substring function. 
&lt;BR /&gt;My project is a Java project, i use TOS 2.3.1 and I have a field (rha.ACTES) in which there is very long string (about 50 characters max, and this field can be nullable), and I want to extract the first eight characters in an other field (ACTE01) thanks to substring. 
&lt;BR /&gt;But I have a problem when I export in an Excel file, I have an error when I run my job... 
&lt;BR /&gt;I think this error comes from tMap. 
&lt;BR /&gt;Thanks for your answers. 
&lt;BR /&gt; 
&lt;BR /&gt;Sofiene92 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MC0Z.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/147280iCA39B5276A81BBE1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MC0Z.png" alt="0683p000009MC0Z.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBhQ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/137478i9C8B8C776801B760/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBhQ.png" alt="0683p000009MBhQ.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Sat, 16 Nov 2024 14:24:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201985#M3866</guid>
      <dc:creator>sofiene92</dc:creator>
      <dc:date>2024-11-16T14:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201986#M3867</link>
      <description>You try to take the first 8 characters of a string, which have less than 8 char's.&lt;BR /&gt;Change your code to the following if you are not sure that your string has at minimum a length of 8 char's:&lt;BR /&gt;&lt;PRE&gt;rha.ACTES.substring(0, java.lang.Math.min(rha.ACTES.length(),8))&lt;/PRE&gt;&lt;BR /&gt;Bye&lt;BR /&gt;Volker</description>
      <pubDate>Tue, 01 Apr 2008 22:18:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201986#M3867</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-04-01T22:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201987#M3868</link>
      <description>Hello, 
&lt;BR /&gt;thank you very much Volker, it works for ACTE01! 
&lt;BR /&gt;But I have an other problem : I want to extract from ACTES 8 characters by 8 characters as we can see on the following sample : 
&lt;BR /&gt;Do you have an idea? 
&lt;BR /&gt;In fact, I want to put a comma 8 caracters by 8 caracters in ACTES, like that : 
&lt;BR /&gt; ACTES ACTES2 
&lt;BR /&gt;LFQK0020NAQK0150NEQK0100YYYY0300 ==&amp;gt; LFQK0020,NAQK0150,NEQK0100,YYYY0300 
&lt;BR /&gt;Thank you for your answers! 
&lt;BR /&gt; 
&lt;BR /&gt;Sofiene92 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBmF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/127987i563D9994D3BA55FD/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBmF.png" alt="0683p000009MBmF.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Wed, 02 Apr 2008 09:23:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201987#M3868</guid>
      <dc:creator>sofiene92</dc:creator>
      <dc:date>2008-04-02T09:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201988#M3869</link>
      <description>Hello again, 
&lt;BR /&gt;this is a little bit tricky. Add the following two code routines to your project: 
&lt;BR /&gt; 
&lt;PRE&gt;    /**&lt;BR /&gt;     * decomposeByFixLength: decompose a String in parts depending on a list of positions&lt;BR /&gt;     * &lt;BR /&gt;     * &lt;BR /&gt;     * {talendTypes} String&lt;BR /&gt;     * &lt;BR /&gt;     * {Category} User Defined&lt;BR /&gt;     * &lt;BR /&gt;     * {param} string("") 	text: The string which should be cut in parts&lt;BR /&gt;     * &lt;BR /&gt;     * {param} int("")		length: The length of each part&lt;BR /&gt;     * &lt;BR /&gt;     * {example} decomposeByFixLength("this is a string", new int[]{3,3,1}) # "thi", "s i", "s".&lt;BR /&gt;     */&lt;BR /&gt;    public static String[] decomposeByFixLength(String text, int[] length) {&lt;BR /&gt;	    if(text == null) return null;&lt;BR /&gt;	    String[] extractedParts= new String;&lt;BR /&gt;    	int actualPart= 0;&lt;BR /&gt;    	for (int len: length) {&lt;BR /&gt;    		extractedParts= text.substring(0, java.lang.Math.min(text.length(), len));&lt;BR /&gt;    		text= text.substring(java.lang.Math.min(text.length(), len));&lt;BR /&gt;    	}&lt;BR /&gt;    	return extractedParts;&lt;BR /&gt;    }&lt;BR /&gt;    &lt;BR /&gt;    &lt;BR /&gt;    /**&lt;BR /&gt;     * join: joins strings together with a given separator&lt;BR /&gt;     * &lt;BR /&gt;     * &lt;BR /&gt;     * {talendTypes} String&lt;BR /&gt;     * &lt;BR /&gt;     * {Category} User Defined&lt;BR /&gt;     * &lt;BR /&gt;     * {param} String("")	parts: Array of Strings to join&lt;BR /&gt;     * &lt;BR /&gt;     * {param} String("")	separator: Separator for the concatenated string parts&lt;BR /&gt;     * &lt;BR /&gt;     * {example} join(new String[]{"this","is","a","test"}, ",") # "this,is,a,test".&lt;BR /&gt;     */&lt;BR /&gt;    public static String join(String[] parts, String separator) {&lt;BR /&gt;	    if(parts.length == 0) return "";&lt;BR /&gt;	    StringBuffer buf = new StringBuffer();&lt;BR /&gt;	    buf.append(parts);&lt;BR /&gt;	    for(int i=1,n=parts.length; i&amp;lt;n; i++)&lt;BR /&gt;	        buf.append(separator).append(parts&lt;I&gt;);&lt;BR /&gt;	    return buf.toString();&lt;BR /&gt;	}&lt;/I&gt;&lt;/PRE&gt; 
&lt;BR /&gt;The documentation does not work. But the functions should do it right. 
&lt;BR /&gt;In your tMap add the following code (I use decomposeString as name for the above routine class): 
&lt;BR /&gt; 
&lt;PRE&gt;decomposeString.join(decomposeString.decomposeByFixLength(rha.ACTES, new int  {8,8,8} ),",")&lt;/PRE&gt; 
&lt;BR /&gt;@Talend-Team: It may be a good idea to add this (or some optimized functions) to TOS itself. Is there a easy qay to share them (e.g. in the Ecosystem) 
&lt;BR /&gt;Bye 
&lt;BR /&gt;Volker</description>
      <pubDate>Wed, 02 Apr 2008 21:02:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201988#M3869</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-04-02T21:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201989#M3870</link>
      <description>Hello!
&lt;BR /&gt;Thank you very much, it works perfectly, I have just changed {8,8,8} by {8,8,8,8,8,8,8,8,8,8} because the field "rha.ACTES" can have a length of 80 max.
&lt;BR /&gt;Finally, I want to put comma 8 by 8 because I will normalize after.
&lt;BR /&gt;And thanks to you, I can continue my work, I was blocked since two days!
&lt;BR /&gt;Danke schön!
&lt;BR /&gt;Best regards...
&lt;BR /&gt;
&lt;BR /&gt;Sofiene92</description>
      <pubDate>Thu, 03 Apr 2008 12:16:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201989#M3870</guid>
      <dc:creator>sofiene92</dc:creator>
      <dc:date>2008-04-03T12:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201990#M3871</link>
      <description>Hi,&lt;BR /&gt;you are welcome! And sorry for my late answer's I managed it only at the night to spend some minutes for TOS... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Bye&lt;BR /&gt;Volker</description>
      <pubDate>Thu, 03 Apr 2008 20:42:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201990#M3871</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-04-03T20:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201991#M3872</link>
      <description>Hi all, 
&lt;BR /&gt;I'm having a similar situation occur to me... 
&lt;BR /&gt;I have a STRING field that can be nullable at times, in which I want to read the first 3 numbers (if there is any data in the field) and use it as the AREACODE. 
&lt;BR /&gt; 
&lt;BR /&gt;For example: 
&lt;BR /&gt;I have a STRING field right now in a file called BusinessPhoneNumber... 
&lt;BR /&gt;This field can be blank (if a client does not have a worknumber) or it can be a phone number, such as 123456789... 
&lt;BR /&gt;If the field is not null then I need to read 123 and spit it out as the AreaCode as an INTEGER.... 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;I tried creating a VARIABLE named workArea as so: 
&lt;BR /&gt;StringHandling.LEFT(row1.workPhoneNum,3) 
&lt;BR /&gt;and then convert it to int by using: 
&lt;BR /&gt;Integer.parseInt(var.workArea) 
&lt;BR /&gt;Only problem with this is if the workPhoneNum field I'm using in the StringHandling.LEFT method is blank, I receive the following error: 
&lt;BR /&gt;java.lang.NumberFormatException: For input string: "" (because currently in the file workPhone is blank, but in other files it may not be) 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Any help would be greatly appreciated! 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 30 Nov 2009 19:59:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201991#M3872</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-30T19:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201992#M3873</link>
      <description>Hello 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;java.lang.NumberFormatException: For input string: "" (because currently in the file workPhone is blank, but in other files it may not be&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;You should handle the empty string first, if it is a empty, define a default value, like just set it as 0. eg: 
&lt;BR /&gt;VARIABLE : 
&lt;BR /&gt;row1.workPhoneNum.equals("")?"" 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M9p6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134116iFBD5D7F21624A744/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M9p6.png" alt="0683p000009M9p6.png" /&gt;&lt;/span&gt;tringHandling.LEFT(row1.workPhoneNum,3) 
&lt;BR /&gt;AreaCode : 
&lt;BR /&gt;var.workArea.equals("")?0:Integer.parseInt(var.workArea) 
&lt;BR /&gt;Best regards 
&lt;BR /&gt; shong</description>
      <pubDate>Tue, 01 Dec 2009 02:44:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201992#M3873</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-01T02:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201993#M3874</link>
      <description>Thanks, Shong! 
&lt;BR /&gt;This worked perfectly!</description>
      <pubDate>Tue, 01 Dec 2009 14:37:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201993#M3874</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-01T14:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201994#M3875</link>
      <description>hi 
&lt;BR /&gt;I can find length of number using below function , where row1.id is integer data type 
&lt;BR /&gt;String.valueOf(row1.id).length() based on this value 
&lt;BR /&gt;i want to do following : 
&lt;BR /&gt;String.valueOf(row1.id).length()&amp;lt;7?row1.id:987+row1.id 
&lt;BR /&gt;i want to append 987 to all numbers whose length is less than 6</description>
      <pubDate>Tue, 17 Sep 2013 11:00:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201994#M3875</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2013-09-17T11:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201995#M3876</link>
      <description>Hi banu, 
&lt;BR /&gt;Using String s=string1+string2 in tMap to append 987 to all numbers whose length is less than 6 and put the expression in filter. 
&lt;BR /&gt;I have a simple demo job to make it clear. 
&lt;BR /&gt;input; 
&lt;BR /&gt;number; 
&lt;BR /&gt;123456; 
&lt;BR /&gt;12345; 
&lt;BR /&gt;12; 
&lt;BR /&gt;1; 
&lt;BR /&gt;12345678; 
&lt;BR /&gt;See my screenshots 
&lt;BR /&gt;It is welcome to open a new topic for your issue so that more user will have a chance to give you a hand. 
&lt;BR /&gt;Best regards 
&lt;BR /&gt;Sabrina 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MC0e.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/147513iEEB6C9AA3A718FAE/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MC0e.png" alt="0683p000009MC0e.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBtZ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/137713iE288A437CE204291/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBtZ.png" alt="0683p000009MBtZ.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Tue, 17 Sep 2013 12:03:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201995#M3876</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-09-17T12:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201996#M3877</link>
      <description>how can i separate with this by range some thing like 150-153&lt;BR /&gt;it should 150,151,152,153 not 150,153</description>
      <pubDate>Tue, 07 Apr 2015 14:00:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201996#M3877</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-07T14:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201997#M3878</link>
      <description>&lt;BLOCKQUOTE&gt;
 &lt;TABLE border="1"&gt;
  &lt;TBODY&gt;
   &lt;TR&gt;
    &lt;TD&gt;how can i separate with this by range some thing like 150-153&lt;BR /&gt;it should 150,151,152,153 not 150,153&lt;/TD&gt;
   &lt;/TR&gt;
  &lt;/TBODY&gt;
 &lt;/TABLE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;BR /&gt;Using tLoop to do a loop.
&lt;BR /&gt;Best regards
&lt;BR /&gt;Shong</description>
      <pubDate>Tue, 07 Apr 2015 16:20:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201997#M3878</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-07T16:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201998#M3879</link>
      <description>I want to separate it in tNormalize with a range , it separate but not range .</description>
      <pubDate>Thu, 09 Apr 2015 12:44:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201998#M3879</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-09T12:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Error substring : index out of range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201999#M3880</link>
      <description>tNormalize is used to normalize the rows by the item separator, for example:
&lt;BR /&gt;150-153
&lt;BR /&gt;normalize this row with separator "-'', the result becomes:
&lt;BR /&gt;150
&lt;BR /&gt;153
&lt;BR /&gt;In your case, you need to parse the data and the get the begin value, and end value, use a tLoop to do a loop and output each value.
&lt;BR /&gt;Best regards
&lt;BR /&gt;Shong</description>
      <pubDate>Fri, 10 Apr 2015 06:57:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Error-substring-index-out-of-range/m-p/2201999#M3880</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-10T06:57:07Z</dc:date>
    </item>
  </channel>
</rss>

