<?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] Split textfile into several files in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-Split-textfile-into-several-files/m-p/2328613#M97881</link>
    <description>Hi&lt;BR /&gt;You need to use tFlowToTerate to iterate each line one by one and set a dynamic output file name. For example:&lt;BR /&gt;tFileInputFullRow--main(row2)--tFlowToIterate--iterate--tjava-oncomponentok--tFixeFlowInput--main--tFileOutputDelimted&lt;BR /&gt;&lt;BR /&gt;Define a context variable called blockID, integer type, set the default value as 0;&lt;BR /&gt;on tJava:&lt;BR /&gt;if(((String)globalMap.get("row2.line")).startsWith("01")){&lt;BR /&gt;context.blockID=context.blockID+1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;on tFixedFlowInput: get the current line, define one column with string type, set its value as:&lt;BR /&gt;(String)globalMap.get("row2.line")&lt;BR /&gt;&lt;BR /&gt;on tFileOutputDelimited, set a dynamic file path, eg:&lt;BR /&gt;"D:/file/out"+context.blockID+".csv"&lt;BR /&gt;&lt;BR /&gt;and check 'append' option.</description>
    <pubDate>Tue, 12 Jan 2016 13:36:59 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-01-12T13:36:59Z</dc:date>
    <item>
      <title>[resolved] Split textfile into several files</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Split-textfile-into-several-files/m-p/2328612#M97880</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;i have a input file with several blocks like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt; 
&lt;PRE&gt;01[many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;01[many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;01[many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;/PRE&gt; 
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Every block has one head row. The goal ist to get an output file for every block starting with 01:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt; 
&lt;PRE&gt;file1.txt&lt;BR /&gt;&lt;BR /&gt;01[many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;/PRE&gt; 
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt; 
&lt;PRE&gt;file2.txt&lt;BR /&gt;&lt;BR /&gt;01[many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;/PRE&gt; 
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt; 
&lt;PRE&gt;file3.txt&lt;BR /&gt;&lt;BR /&gt;01[many numbers]]&lt;BR /&gt;02 [many numbers]&lt;BR /&gt;02 [many numbers]&lt;/PRE&gt; 
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Any ideas how to handle that?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 10:29:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Split-textfile-into-several-files/m-p/2328612#M97880</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-12T10:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Split textfile into several files</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Split-textfile-into-several-files/m-p/2328613#M97881</link>
      <description>Hi&lt;BR /&gt;You need to use tFlowToTerate to iterate each line one by one and set a dynamic output file name. For example:&lt;BR /&gt;tFileInputFullRow--main(row2)--tFlowToIterate--iterate--tjava-oncomponentok--tFixeFlowInput--main--tFileOutputDelimted&lt;BR /&gt;&lt;BR /&gt;Define a context variable called blockID, integer type, set the default value as 0;&lt;BR /&gt;on tJava:&lt;BR /&gt;if(((String)globalMap.get("row2.line")).startsWith("01")){&lt;BR /&gt;context.blockID=context.blockID+1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;on tFixedFlowInput: get the current line, define one column with string type, set its value as:&lt;BR /&gt;(String)globalMap.get("row2.line")&lt;BR /&gt;&lt;BR /&gt;on tFileOutputDelimited, set a dynamic file path, eg:&lt;BR /&gt;"D:/file/out"+context.blockID+".csv"&lt;BR /&gt;&lt;BR /&gt;and check 'append' option.</description>
      <pubDate>Tue, 12 Jan 2016 13:36:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Split-textfile-into-several-files/m-p/2328613#M97881</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-12T13:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Split textfile into several files</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Split-textfile-into-several-files/m-p/2328614#M97882</link>
      <description>Thx shong!</description>
      <pubDate>Fri, 15 Jan 2016 07:48:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Split-textfile-into-several-files/m-p/2328614#M97882</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-15T07:48:58Z</dc:date>
    </item>
  </channel>
</rss>

