<?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: Variable Number of Delimited Fields in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264958#M44641</link>
    <description>Hi alevy,&lt;BR /&gt;It seems like, the add-info always at the end, assuming yes, how can this be done?</description>
    <pubDate>Tue, 20 Jul 2010 07:28:03 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-07-20T07:28:03Z</dc:date>
    <item>
      <title>Variable Number of Delimited Fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264955#M44638</link>
      <description>Hi, 
&lt;BR /&gt;I need help with a task in Talend.
&lt;BR /&gt;I have a delimeted tab file, but the number of columns is variable in each row.
&lt;BR /&gt;Let me sample it:
&lt;BR /&gt;john 23 productx productx add-info
&lt;BR /&gt;jack 25 productx add-info
&lt;BR /&gt;july 33 productx productx productx productx add-info
&lt;BR /&gt;Theres no reserved space for products, and I need to get the add-info after.
&lt;BR /&gt;Example (output that I need to generate):
&lt;BR /&gt;john 23 productx productx (blank) (blank) add-info
&lt;BR /&gt;jack 25 productx (blank) (blank) (blank) add-info
&lt;BR /&gt;july 33 productx productx productx productx add-info
&lt;BR /&gt;Don't know if I made myself clear enough.... But thanks for any help.</description>
      <pubDate>Sat, 16 Nov 2024 13:21:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264955#M44638</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T13:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Number of Delimited Fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264956#M44639</link>
      <description>Hope someone from Team Talend take a look at your case &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; it's kinda pretty hard :-)
&lt;BR /&gt;These are the things that make the input file complicated:
&lt;BR /&gt;1. the unknown number of productx
&lt;BR /&gt;2. there is no identifier or key to each column(this will help us to determine the header value)
&lt;BR /&gt;3. the "add-info" has no permament place.
&lt;BR /&gt;4. it is not typical input flat file :-)
&lt;BR /&gt;But still, your case is very much interesting &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 14 Jul 2010 08:06:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264956#M44639</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-14T08:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Number of Delimited Fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264957#M44640</link>
      <description>If you read across each row, how do you tell which value is a "productx" and which is "add-info". Is it just that there is always exactly one "add-info" as the last value in a row?</description>
      <pubDate>Tue, 20 Jul 2010 07:10:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264957#M44640</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2010-07-20T07:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Number of Delimited Fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264958#M44641</link>
      <description>Hi alevy,&lt;BR /&gt;It seems like, the add-info always at the end, assuming yes, how can this be done?</description>
      <pubDate>Tue, 20 Jul 2010 07:28:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264958#M44641</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-20T07:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Number of Delimited Fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264959#M44642</link>
      <description>Well, assuming: 
&lt;BR /&gt;-- we know only that there is always exactly one "add-info" as the last value in a row 
&lt;BR /&gt;-- we do not know the maximum number of "productx" there can be on any row 
&lt;BR /&gt;-- the output is also to a delimited file 
&lt;BR /&gt;-- the "add-info" must remain the last value in the row 
&lt;BR /&gt;Then we need to first read the file to find the maximum number of "productx" across all rows. Use tFileInputFullRow and send to tMap. There define a new field ProductCount = StringHandling.COUNT(row1.line,"\t")-2. The output of tMap goes to tAggregateRow, which calculates the max of all ProductCounts. The output of tAggregateRow goes to tSetGlobalVar. 
&lt;BR /&gt;Then link the first tFileInputFullRow to another identical tFileInputFullRow using OnSubjobOK. The flow from the second tFileInputFullRow goes to tJavaRow, which contains the following code: 
&lt;BR /&gt; 
&lt;PRE&gt;Integer LastDelimiter = input_row.line.lastIndexOf('\t');&lt;BR /&gt;output_row.line = input_row.line.substring(0,LastDelimiter)&lt;BR /&gt;   +StringHandling.STR('\t',(Integer)globalMap.get("MaxProductCount")-StringHandling.COUNT(input_row.line,"\t")+2)&lt;BR /&gt;   +input_row.line.substring(LastDelimiter);&lt;/PRE&gt; 
&lt;BR /&gt;The flow from tJavaRow should be what you need to write to tFileOutputDelimited.</description>
      <pubDate>Tue, 20 Jul 2010 08:16:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264959#M44642</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2010-07-20T08:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Number of Delimited Fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264960#M44643</link>
      <description>Hi alevy, 
&lt;BR /&gt;Confirmed, it works! 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; (assuming it is delimited) You are great 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MA9p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138034i5F552429DA646D6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MA9p.png" alt="0683p000009MA9p.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Tue, 20 Jul 2010 09:09:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264960#M44643</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-20T09:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Number of Delimited Fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264961#M44644</link>
      <description>Thanks alevy and lovely, will try this solution asap.</description>
      <pubDate>Mon, 26 Jul 2010 21:25:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264961#M44644</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-26T21:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Number of Delimited Fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264962#M44645</link>
      <description>Hi, sorry for taking so long to do the test, but I was really busy.&lt;BR /&gt;I tried your solution alevy, but is just outputted the same file that was inputted. Did I miss something?&lt;BR /&gt;Thanks.</description>
      <pubDate>Wed, 04 Aug 2010 19:30:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264962#M44645</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-08-04T19:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Number of Delimited Fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264963#M44646</link>
      <description>I'd have to say: probably 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;. Did you set MaxProductCount correctly in tSetGlobalVar? Add a tLogRow after tAggregateRow and a tJava with the following code after tSetGlobalVar to test that the max has been correctly stored. 
&lt;BR /&gt; 
&lt;PRE&gt;System.out.println((Integer)globalMap.get("MaxProductCount"));&lt;/PRE&gt; 
&lt;BR /&gt;If both print the same result then put up screenprints of your job.</description>
      <pubDate>Fri, 06 Aug 2010 07:33:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264963#M44646</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2010-08-06T07:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Number of Delimited Fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264964#M44647</link>
      <description>Geeez it's so nice to be back in Talend ( got hooked with Silverlight project recently and it's driving me nuts!!!) 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;MaxProductCount -&amp;gt; This did the trick, right Alevy? 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; You must know the maximum count of the productx so that the add-info will be put on the nth(maxproductcount) place.</description>
      <pubDate>Fri, 06 Aug 2010 09:00:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Variable-Number-of-Delimited-Fields/m-p/2264964#M44647</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-08-06T09:00:56Z</dc:date>
    </item>
  </channel>
</rss>

