<?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 Merge Multiple Text Files into one with a row at the beginning of each file in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Merge-Multiple-Text-Files-into-one-with-a-row-at-the-beginning/m-p/2350911#M117679</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am new to Talend and need help from your guys.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to Merge multiple text files from a directory which I was able to do with following&lt;/P&gt;&lt;P&gt;tFileList -&amp;gt; tFileInputFullRow -&amp;gt; tFileOutputDelimited&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the challenging part for me ....&lt;/P&gt;&lt;P&gt;At the Beginning of each text file merge I have to add a row to the output and the row should contain (as though it's an identification that a new file data has begun)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;foldername&amp;gt;&amp;lt;yyyymmddhhmmss&amp;gt;&amp;lt;11 character spaces&amp;gt;&amp;lt;sequenceno&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note : Above line should only occur only once when a new text file is picked to be merged&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Files are sitting in following directory &lt;/P&gt;&lt;P&gt;U:\Talend_GOAnywhere_Jobs\Inventory_Jobs\s0325366\up\IM25366.txt&lt;/P&gt;&lt;P&gt;U:\Talend_GOAnywhere_Jobs\Inventory_Jobs\s1628062\up\IM28062.txt&lt;/P&gt;&lt;P&gt;U:\Talend_GOAnywhere_Jobs\Inventory_Jobs\s2951288\up\IM51288.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;foldername&amp;gt; holds value 0325366 for 1st file; 1628062 for 2nd file; 2951288 for 3rd file and so on .......&lt;/P&gt;&lt;P&gt;yyyymmddhhmmss -&amp;gt; Current Talend Date &lt;/P&gt;&lt;P&gt;11 character space &lt;/P&gt;&lt;P&gt;Sequenceno of text file merging &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for 2nd text file following is what will be added at the beginning before the file gets merged&lt;/P&gt;&lt;P&gt;162806220210625031406           0000002&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried adding getCurrentDate variable to tMap but it appending to every row in text file at the beginning. &lt;/P&gt;&lt;P&gt;Each text file can have as many as 400-500 lines and it's appending each of those line.&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 00:00:48 GMT</pubDate>
    <dc:creator>MRup</dc:creator>
    <dc:date>2024-11-16T00:00:48Z</dc:date>
    <item>
      <title>Merge Multiple Text Files into one with a row at the beginning of each file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Merge-Multiple-Text-Files-into-one-with-a-row-at-the-beginning/m-p/2350911#M117679</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am new to Talend and need help from your guys.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to Merge multiple text files from a directory which I was able to do with following&lt;/P&gt;&lt;P&gt;tFileList -&amp;gt; tFileInputFullRow -&amp;gt; tFileOutputDelimited&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the challenging part for me ....&lt;/P&gt;&lt;P&gt;At the Beginning of each text file merge I have to add a row to the output and the row should contain (as though it's an identification that a new file data has begun)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;foldername&amp;gt;&amp;lt;yyyymmddhhmmss&amp;gt;&amp;lt;11 character spaces&amp;gt;&amp;lt;sequenceno&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note : Above line should only occur only once when a new text file is picked to be merged&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Files are sitting in following directory &lt;/P&gt;&lt;P&gt;U:\Talend_GOAnywhere_Jobs\Inventory_Jobs\s0325366\up\IM25366.txt&lt;/P&gt;&lt;P&gt;U:\Talend_GOAnywhere_Jobs\Inventory_Jobs\s1628062\up\IM28062.txt&lt;/P&gt;&lt;P&gt;U:\Talend_GOAnywhere_Jobs\Inventory_Jobs\s2951288\up\IM51288.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;foldername&amp;gt; holds value 0325366 for 1st file; 1628062 for 2nd file; 2951288 for 3rd file and so on .......&lt;/P&gt;&lt;P&gt;yyyymmddhhmmss -&amp;gt; Current Talend Date &lt;/P&gt;&lt;P&gt;11 character space &lt;/P&gt;&lt;P&gt;Sequenceno of text file merging &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for 2nd text file following is what will be added at the beginning before the file gets merged&lt;/P&gt;&lt;P&gt;162806220210625031406           0000002&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried adding getCurrentDate variable to tMap but it appending to every row in text file at the beginning. &lt;/P&gt;&lt;P&gt;Each text file can have as many as 400-500 lines and it's appending each of those line.&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 00:00:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Merge-Multiple-Text-Files-into-one-with-a-row-at-the-beginning/m-p/2350911#M117679</guid>
      <dc:creator>MRup</dc:creator>
      <dc:date>2024-11-16T00:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Multiple Text Files into one with a row at the beginning of each file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Merge-Multiple-Text-Files-into-one-with-a-row-at-the-beginning/m-p/2350912#M117680</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;Need to check if it is the 1st file or the 2nd file using runIf trigger, for example, the job design looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tFileList--iterate--tJava--runIf1--tFileInputFullRow -&amp;gt; tFileOutputDelimited&lt;/P&gt;&lt;P&gt;                                   --runIf2--tFixedFlowInput--main-tFileOutputDelimited--onComponentOK--tFileInputFullRow -&amp;gt; tFileOutputDelimited&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;on tJava, get the current folder name, current date string, generate the Sequenceno and store these value to global variables for used later on tFixedFlowInput.&lt;/P&gt;&lt;P&gt;on tFixedFlowInput, generate the new row and append it to the target file before reading the 2nd file. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set the condition of runIf1:&lt;/P&gt;&lt;P&gt;((Integer)globalMap.get("tFileList_1_NB_FILE"))==1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set the condition of runIf2:&lt;/P&gt;&lt;P&gt;((Integer)globalMap.get("tFileList_1_NB_FILE"))!=1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shong&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;                                &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2021 10:38:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Merge-Multiple-Text-Files-into-one-with-a-row-at-the-beginning/m-p/2350912#M117680</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-01T10:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Multiple Text Files into one with a row at the beginning of each file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Merge-Multiple-Text-Files-into-one-with-a-row-at-the-beginning/m-p/2350913#M117681</link>
      <description>&lt;P&gt;Thankyou so much shong for your help.&lt;/P&gt;&lt;P&gt;It works. Truly Appreciated&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 18:46:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Merge-Multiple-Text-Files-into-one-with-a-row-at-the-beginning/m-p/2350913#M117681</guid>
      <dc:creator>MRup</dc:creator>
      <dc:date>2021-07-08T18:46:41Z</dc:date>
    </item>
  </channel>
</rss>

