create output file with rolling file name

One Star

create output file with rolling file name

Hi ,
I need to create a job which will create a new output file(rolling file name) for every time I run the job. some thing like
out_001.xml
out_002.xml
out_003.xml
do you have any idea to achieve this using Talend?
Thanks in advance.

Re: create output file with rolling file name

keep a count on a DB/file for this job
so everytime, job starts you read this value and set it in a variable (used in the output file)
good?
Highlighted
Seven Stars

Re: create output file with rolling file name

Or you can use tFileList --> IterateToFlow --> tMap (to parse file numbers) --> tAggregateRow (to find the max) --> tSetGlobalVar and then use the global variable in your file name.
One Star

Re: create output file with rolling file name

Or you can use tFileList --> IterateToFlow --> tMap (to parse file numbers) --> tAggregateRow (to find the max) --> tSetGlobalVar and then use the global variable in your file name.

can you discuss the process in more details , like select bla bla from bla bla then connect to bla bla ..
thx
Seven Stars

Re: create output file with rolling file name

See screenprint
One Star

Re: create output file with rolling file name

thanks alevy.. I tried another way..
One Star

Re: create output file with rolling file name

thx alevy
@ashu : will you please discuss your way here too ..
One Star

Re: create output file with rolling file name

I have one approach where I appended date and time in outputfile like dd-mm-yyyy_hh_MM_ss
One Star

Re: create output file with rolling file name

it was so simple.. I just created a table with one row.. two columns.. FileName and Sequence... i will be querying that table to get the filename and sequence number.. after that increment the sequence number..
here I'm attaching my job but its different from what I explained.. in tjavarow I'm doin some condition checks...

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog