<?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 Add incremental number to output file in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Add-incremental-number-to-output-file/m-p/2285329#M58951</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;is it possible to get outfiles with an incremental number?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Let's say we have a job and this job will create the file output_001.csv&lt;/P&gt; 
&lt;P&gt;If we start the job again then we'll get output_002.csv and if we start the job 3rd time then output_003.csv etc.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks for any advice.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 06:31:08 GMT</pubDate>
    <dc:creator>pawe84</dc:creator>
    <dc:date>2024-11-16T06:31:08Z</dc:date>
    <item>
      <title>Add incremental number to output file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Add-incremental-number-to-output-file/m-p/2285329#M58951</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;is it possible to get outfiles with an incremental number?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Let's say we have a job and this job will create the file output_001.csv&lt;/P&gt; 
&lt;P&gt;If we start the job again then we'll get output_002.csv and if we start the job 3rd time then output_003.csv etc.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks for any advice.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 06:31:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Add-incremental-number-to-output-file/m-p/2285329#M58951</guid>
      <dc:creator>pawe84</dc:creator>
      <dc:date>2024-11-16T06:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Add incremental number to output file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Add-incremental-number-to-output-file/m-p/2285330#M58952</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; If you are storing the last file number in a location (it can be file, DB etc), you can read it from there to a context variable (say &lt;SPAN&gt;running_number)&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;While writing the file, you can add the file name in the output as "&lt;SPAN&gt;output_"+context.running_number+".csv"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Once the data output to file is complete, you can write the new output back to the area where you are storing last output file number. In this way, it will work fine. I would suggest to use a table in DB to store this control information.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm Regards,&lt;BR /&gt;Nikhil Thampi&lt;/P&gt;
&lt;P&gt;Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 13:24:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Add-incremental-number-to-output-file/m-p/2285330#M58952</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-22T13:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Add incremental number to output file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Add-incremental-number-to-output-file/m-p/2285331#M58953</link>
      <description>&lt;P&gt;Below&amp;nbsp; Approach&amp;nbsp; would help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) keep a File having last run sequence in your local disk . Read this file at the start of job and use it to create your next run file. Update the same file for next run sequence.&lt;/P&gt;
&lt;P&gt;(Note : If you are using Context file , you can simply update new sequence in that file)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2) You could use system Variable instead of File . Get/Set using value tSystem and tSetenv&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) using tFileFetch , get the latest created file name in the output folder .&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Get the last part from string so for&amp;nbsp;&lt;SPAN&gt;output_003.csv it would be 003&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Add 1 to it , use new value to create Output.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 13:31:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Add-incremental-number-to-output-file/m-p/2285331#M58953</guid>
      <dc:creator>akumar2301</dc:creator>
      <dc:date>2019-02-22T13:31:15Z</dc:date>
    </item>
  </channel>
</rss>

