Talend获取当前文件名 [英] Talend get current filename

查看:149
本文介绍了Talend获取当前文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将excel文件加载到mysql数据库中并检查它们是否不存在,我的问题是我无法提取当前文件的名称.

I want to load excel files into the mysql database and check that they do not already exist, my problem is that I can not extract the name of the current file.

例如,我有以下文件A.xlsxB.xlsxC.xls.

For example, I have the following files A.xlsx, B.xlsx and C.xls.

它总是返回B.xlsx

推荐答案

我认为您的问题是您的"RunIf"链接位于迭代器之前,因此未在正确的时间触发.

I think the issue you have is that your "RunIf" link is before the iterator, and therefore it's not being triggered at the right time.

下图显示了简化版本,其中列出了电子表格中的行,然后列出了文件名.如果像您在问题中那样将第二个子作业连接到tFileList_1组件,则只能从tLogRow_1获取日志,并从tLogRow_2获取最后一个文件名.

The image below shows a simplified version, where I list the rows in the spreadsheets and then the file names. If I connected the second subjob to the tFileList_1 component, as you did in the question, I only get the logs from tLogRow_1 and the last filename by tLogRow_2.

使用所示链接,在迭代器后面,然后列出电子表格内容,然后列出其标题:

With the link as shown, behind the iterator, then I get spreadsheet contents listed and then the title of it:

Col1|Col2|Col3
A|B|C
D|E|F
A.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
B.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
C.xlsx

我假设您已过滤出tMap组件中的重复文件,因此,如果从disponsibilite_3d组件链接第二个子作业,我想您会得到想要的结果.

I am assuming that you have filted out the duplicated files in the tMap component, so if you link your second subjob from the disponsibilite_3d component, I think you will get the result you are looking for.

这篇关于Talend获取当前文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆