动态地将文件掩码放在 tFileList 组件上
Put File Mask on tFileList Component dynamically
我想知道您能否告诉我如何在 Talend 中为 tFilelist 组件设置文件掩码,使其自动识别日期并且只下载所需日期的数据?
我尝试了一些方法,但遇到了一些错误,例如 "the method add (string) in the type list <String>
is not applicable for the arguments (Date)"
有两种方法。
- 创建上下文变量并在文件掩码中使用该变量。
- 直接在文件掩码中使用TalendDate.getDate() 或任何其他日期函数。
在组件
中查看它们
第一种方法,
- 创建以 dateFilter 命名的上下文变量作为字符串类型。
- 赋值给
context.dateFilter=TalendDate.getDate("yyyy-MM-dd");
- 假设您的文件名为
"ABC_2015-06-19.txt"
那么
在 tFileList 文件掩码中按如下方式使用此变量。
"ABC_"+context.dateFilter+".*"
第二种方法
在tFileList文件掩码中使用日期函数如下。
"ABC_"+TalendDate.getDate("yyyy-MM-dd")+".*"
这是两个最好的方法,您可以根据文件名更改文件掩码。
我想知道您能否告诉我如何在 Talend 中为 tFilelist 组件设置文件掩码,使其自动识别日期并且只下载所需日期的数据?
我尝试了一些方法,但遇到了一些错误,例如 "the method add (string) in the type list <String>
is not applicable for the arguments (Date)"
有两种方法。
- 创建上下文变量并在文件掩码中使用该变量。
- 直接在文件掩码中使用TalendDate.getDate() 或任何其他日期函数。
在组件
中查看它们第一种方法,
- 创建以 dateFilter 命名的上下文变量作为字符串类型。
- 赋值给
context.dateFilter=TalendDate.getDate("yyyy-MM-dd");
- 假设您的文件名为
"ABC_2015-06-19.txt"
那么 在 tFileList 文件掩码中按如下方式使用此变量。
"ABC_"+context.dateFilter+".*"
第二种方法
在tFileList文件掩码中使用日期函数如下。
"ABC_"+TalendDate.getDate("yyyy-MM-dd")+".*"
这是两个最好的方法,您可以根据文件名更改文件掩码。