Date column Null Tmap

Five Stars

Date column Null Tmap

Hi,

 

I am facing an issue with Date Column conversion.

I have multiple date column "YYYY-MM-DD"

 

Flow of Talend job

Input (.txt file)-->tmap-->Snowflake table.

 

I have done variable conversion in tmap :

 

TalendDate.isDate(row5.Column0,"yyyy-MM-dd") ? TalendDate.parseDate("yyyy-MM-dd", row5.Column0) : null 

 

I am facing runtime error: 

 

Input String : NULL 

 

Please help me to resolve this.

 

 

 

 


Accepted Solutions
Five Stars

Re: Date column Null Tmap

Hey ,

 

Thanks for your help.

 

Worked fine with the below code :

TalendDate.isDate(row5.Column0,"yyyy-MM-dd hh:mm:ss.SSS") ? TalendDate.parseDate("yyyy-MM-dd hh:mm:ss.SSS", row5.Column0) : null 

 

I guess the issue was with other columns .

 

Thank you.


All Replies
Seven Stars

Re: Date column Null Tmap

this error only comes when your input string is null.

Regards
Aashish
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Employee

Re: Date column Null Tmap

Hi,

 

Please add a null condition check as the first step to avoid the error. Sample code is as below.

 

!Relational.ISNULL(row5.Column0)?
(TalendDate.isDate(row5.Column0,"yyyy-MM-dd") ? TalendDate.parseDate("yyyy-MM-dd", row5.Column0) : null) : null

 

If the suggestion given has helped you, could you please mark the topic as solution provided?

 

Warm regards,

 

Nikhil Thampi

Tags (1)
Five Stars

Re: Date column Null Tmap

Hey ,

 

Thanks for your help.

 

Worked fine with the below code :

TalendDate.isDate(row5.Column0,"yyyy-MM-dd hh:mm:ss.SSS") ? TalendDate.parseDate("yyyy-MM-dd hh:mm:ss.SSS", row5.Column0) : null 

 

I guess the issue was with other columns .

 

Thank you.