• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » How to generate dinamic name for tFileOutputExcel

#1 2008-04-08 15:04:50

fedepia
New member
Registered: 2007-11-29
Posts: 8

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

Offline

#2 2008-04-08 22:29:41

Volker Brehm
Member
Registered: 2007-04-03
Posts: 1139
Website

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

Offline

#3 2008-04-08 22:38:54

mhirt
Talend team
Registered: 2006-09-19
Posts: 1638

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,

Offline

#4 2008-04-08 23:52:03

fedepia_
Guest

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.

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » How to generate dinamic name for tFileOutputExcel

Board footer

Powered by FluxBB