Six Stars

Method not defined for parseDate()

Hi,
I am trying to convert a string that contains nulls into Date format. The data is in csv so I have a main connection to the tJavaRow with the code:
output_row.Date = input_row.Date.equals("")?null : parseDate("MM/dd/yyyy", input_row.Date)
Error:

The method parseDate(String, String) is undefined for the type ......
1 REPLY
Community Manager

Re: Method not defined for parseDate()

Hi 
tJavaRow doesn't support the expression like this
output_row.Date = input_row.Date.equals("")?null : parseDate("MM/dd/yyyy", input_row.Date)

You should use tMap component, and write the expression as:
row1.Date.equals("")?null:TalendDate.parseDate("MM/dd/yyyy",row1.Date)

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business