Monday, 27 May 2019

Put File Mask on tFileList Component dynamically in Talend

Put File Mask on tFileList Component dynamically in Talend

How I can set file mask for tFilelist component in Talend that it recognize date automatically and it will download only data for desired date?

There are two ways of doing it.
1.    Create context variable and use this variable in file mask.
2.    Directly use TalendDate.getDate() or any other date function in file mask.
See both of them in component
1st Menthod,
·         Create context variable named with dateFilter as string type.
·         Assign value to context.dateFilter=TalendDate.getDate("yyyy-MM-dd");
·         Suppose you have file name as "EMP_2015-06-19.txt" then
·         In tFileList file mask use this variable as follows.
"EMP_"+context.dateFilter+".*"

2nd Menthod
·         In tFileList file mask use date function as follows.
"EMP_"+TalendDate.getDate("yyyy-MM-dd")+".*"


Above are the two best way, you can make changes in file mask per your file names.

1 comment:

Scinario Based interview Question .....

 How  To Achieve The Scenario. Input File1.csv  id,Name 1,Mahendra File2.csv City, State Hyd,Telangana File3.csv Stateid Ts I want Out put F...