英文:
Remove invalid values in Talend
问题
我有一个包含日期列的Excel输入文件,其中一些日期不正确。当执行我的作业时,我收到以下错误消息:
The cell format is not Date in ( Row. 128 and ColumnNum. 3 )
The cell format is not Date in ( Row. 172 and ColumnNum. 3 )
The cell format is not Date in ( Row. 315 and ColumnNum. 3 )
The cell format is not Date in ( Row. 406 and ColumnNum. 3 )
我希望能筛选出这些值,以避免这种错误。事实上,日期不正确的行包含值“-”,这意味着我们不知道正确的日期是什么。如果我能够简单地筛选出所有日期格式不正确的行,那将非常好。
我正在考虑使用筛选或条件语句,但由于我的输入列是日期,所以遇到了一些困难。
有什么帮助吗?谢谢
英文:
I have an excel input file with a date column, some of those dates are not correct and when executing my job, I got the following error
The cell format is not Date in ( Row. 128 and ColumnNum. 3 )
The cell format is not Date in ( Row. 172 and ColumnNum. 3 )
The cell format is not Date in ( Row. 315 and ColumnNum. 3 )
The cell format is not Date in ( Row. 406 and ColumnNum. 3 )
I would like then to filter these values so that I will avoid this kind of error
In fact, the rows where the date is not correct contains the value "-", that means that we don t know the correct date. It would be great if I can simply filter all the rows which have an incorrect date format.
I m thinking about a filter or an If condition, but as my input column is a date, I have some difficulties.
Any Help? Thanks
答案1
得分: 2
你可以首先将Excel中的日期字段作为字符串检索出来,这样你就不会出现任何错误。然后,在使用tFilterRow时,你可以排除日期为"-"的行。接下来,在tMap中,你可以使用TalendDate.parseDate方法将字符串转换为日期。
英文:
You can have a first step where you retrieve your Date field from excel as a String : this way you won't get any error. Then with a tFilterRow, you can exclude rows where date is "-". Then you convert in a tMap your string to a Date using TalendDate.parseDate method.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论