Reputation: 17
My job Talend is about mapping between a csv file and a postregresql table. I need to insert a column date which can be with normal format yyyyMMdd or(0/99999999) in the csv file. So if the date is equal to 0 or 99999999 it's will be mapping as a null variable in the database, else the data must be loaded as a date type timestamp yyyy-mm-dd HH:mm:ss.
In the csv file I declared the date as an int, so I must parse int to a datetime in the tmap and loaded the 0/99999999 as a null variable. Any help please.
Upvotes: 0
Views: 768
Reputation: 62
if I understand the problem correctly, its solution is as follows:
// correspondent expression to convert string with special "0/99999999" values is: (row1.dateAsString.equals("0")||row1.dateAsString.equals("99999999"))?null:routines.TalendDate.parseDate("yyyyMMdd", row1.dateAsString)
Upvotes: 0