Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

create output file w/ dynamic filename

How do we create a filename "%JOBNAME%_%TIMESTAMP%.csv" dynamically and use it to store data from a table in a directory. The path can be passed into a job as a variable.
Labels (2)
9 Replies
Anonymous
Not applicable
Author

Use the following code in java:
jobName + "_" + TalendDate.formatDate("yyyyMMddHHmmssSSS", TalendDate.getCurrentDate()) + ".csv"
Anonymous
Not applicable
Author

in a Perl project:
$_globals{job_name} . '_' . getDate('CCYYMMDDhhmmss') . '.csv'

in a Java project:
jobName + "_" + TalendDate.formatDate("yyyyMMddHHmmss", new Date()) + ".csv"
Anonymous
Not applicable
Author

Please note that you can find global variables and usable function using auto-completion CTRL+space in any text field.
Anonymous
Not applicable
Author

What about if i want to create a filename for each row, with the content of the columns?
For example i have this input info 
(row1) calculoMasivosResumen;2016-02-10;14:01:01
(row2) calculoTemporalGes;2016-02-10;14:07:41
(row3) controlComisionesTardia;2016-02-10;14:05:04
I want a file name called calculoMasivosResumen_2016-02-10_14:01:01.txt, another file called   calculoTemporalGes_2016-02-10_14:07:41.txt and other called controlComisionesTardia_2016-02-10_14:05:04.txt
I'm clear?
Thank you in advance for your help.
Anonymous
Not applicable
Author

I've got the same question, I want to create over 30 files one per specific ID, however I would like to do it without creation of 30 tMaps outputs..
example: outputFilename: context.talendPath+"Projects/DWH/test_"+row7.id+".csv"
however this solution or using globalMap, creates only file for first id and then it's fixed.
Anonymous
Not applicable
Author

Hello Diego, 
I just want to let you know that thanks to stackoverflow Ive found solution:
http://stackoverflow.com/questions/25684433/how-to-create-multiple-output-files-in-talend-based-on-a...
After reading this I got a main design in my head.
it is not the fastest solution but it works like a charm. let me know if you have any further questions.
Anonymous
Not applicable
Author

Thx for sharing!
Anonymous
Not applicable
Author

Hi dirk, let me know if you will need help. Ive everything tested and working on prod site.
Anonymous
Not applicable
Author

I demonstrate an easy way of doing this in this tutorial ( https://www.rilhia.com/tutorials/load-data-dynamic-number-files)