Tuesday, September 12, 2017

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 "ABC_2015-06-19.txt" then
·         In tFileList file mask use this variable as follows.
"ABC_"+context.dateFilter+".*"

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


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

2 comments: