How to generate dinamic name for tFileOutputExcel

Two Stars

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
One Star

Re: How to generate dinamic name for tFileOutputExcel

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
Employee

Re: How to generate dinamic name for tFileOutputExcel

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

Re: How to generate dinamic name for tFileOutputExcel

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.