how to append a data to the existing csv file that changes its name every time?

Five Stars

how to append a data to the existing csv file that changes its name every time?

Hi,

 

I have a job that loops through and produces a csv file after every 5000 records. The csv file gets its name by the current timestamp("Talend/workspace/stock_"+TalendDate.formatDate("yyyyMMdd_hhmmss",TalendDate.getCurrentDate()) +".csv"). I need to append the data to the same file after every 5000 records until the record limit has reached. 

But, the issue is that it creates a new csv file every time because of the its name which uses current time stamp as its name. If I don't use the current time stamp as a csv file name then it does append the data to the same csv. But its not enogh in my case.

 

Any solutions?

 

Thanks 

Five Stars

Re: how to append a data to the existing csv file that changes its name every time?

Sloution not required anymore. sorted

Highlighted
Nine Stars

Re: how to append a data to the existing csv file that changes its name every time?

Good news! By the way, you can use
TalendDate.getDate("yyyyMMdd_hhmmss")
To get the current date in a given format.

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog