Put File Mask on tFileList Component dynamically

7k views Asked by At

I was wondering if you let me know 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? I have tried some approach and I faced with some errors like "the method add (string) in the type list <String> is not applicable for the arguments (Date)"

1

There are 1 answers

0
UmeshR On BEST ANSWER

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 approach,

  • 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 approach

  • In tFileList file mask use date function as follows.

    "ABC_"+TalendDate.getDate("yyyy-MM-dd")+".*"

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