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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to generate dinamic name for tFileOutputExcel

Hello, how are you? I want to create a tFileOutputExcel with a dinamic name, i.e. by every job executed, I would like to write the sql result, and I want the following structure:
2008
\-- January
\--- 01.xls
\--- 02.xls
.....
\-- April
\--- 01.xls
\--- 02.xls
.....
Currently I have all log files in one folder. My tFileOutputExcell filename attribute is:
System.getenv("LOG_DIR") + "/data/PersonsLog" + TalendDate.getDate("CCYY-MM-DD hhmmss") + ".xls"
But I need this
System.getenv("LOG_DIR") + "/data/" + YEAR + "/" + MONTH + "/PersonsLog" + TalendDate.getDate("CCYY-MM-DD hhmmss") + ".xls"
Can anybody tell me how i can do that?
Thanks
Labels (2)
3 Replies
Anonymous
Not applicable
Author

Hello,
in the same way you create your filename, you can get the YEAR and the NAME. Take a look at the java documentation (SimpleDateFormatter) to see which output you can get from this function (TalendDate.getDate uses the same functions).
http://java.sun.com/j2se/1.5.0/docs/api/
Bye
Volker
Anonymous
Not applicable
Author

Hello,
You can try :
System.getenv("LOG_DIR") + "/data/" + TalendDate.getDate("CCYY")+ "/" + TalendDate.getDate("MMM") + "/PersonsLog" + TalendDate.getDate("CCYY-MM-DD hhmmss") + ".xls"
HTH,
_AnonymousUser
Specialist III
Specialist III

hello mhirt, I'm understood perfectly. I think it will work without problem.
Volker I think you wanted to say same as mhirt.
Thank you both so very much for answer me.