One Star

Unparseable date "null"

Hi,
I work on TIS 2.4.2. and I have a problem with some dates.
I have a source datebase that have a field date that can be sometimes "null"
And I tried to :
- convert it to string in the SQL request
- I tried to change the type in a schema of the source to String
- I tried to make a condition in a tmap : date.equals("null")? " ":date or I tried date == "null"? " ":date
What I have to do? create a routine?
Thanks in advance
8 REPLIES
One Star

Re: Unparseable date "null"

Hi,
If your date input is string, try with :
date.equals("")?null:TalendDate.ParseDate("MM-dd-yyyy HH:mm:ss",date)

I had a case like this, for exemple :
(input_map.DT_DEB_VALID_OBJ.equals(""))?null:TalendDate.parseDate("MM/dd/yyyy",input_map.DT_DEB_VALID_OBJ)
Best Regards,
Guillaume.
One Star

Re: Unparseable date "null"

But my input is not a String It's a date.
And I already tried what you propose.
In addition, It's not " " but null that I have on my source database so it's not the same case.
But thanks
One Star

Re: Unparseable date "null"

In fact I have a problem to read a date that is null
One Star

Re: Unparseable date "null"

not sure what exactly ur requirement is
what i understood is , u r trying tp parse thedate and it is hitting null pointer exception.
if this is the case
try
null != date? parse : do not parse or set it to null
hopr this would help
One Star

Re: Unparseable date "null"

thanks I will try
One Star

Re: Unparseable date "null"

thanks i had same issue with " " 
date.equals("")?null:TalendDate.ParseDate("MM-dd-yyyy HH:mm:ss",date)

and I tried and it works for me
One Star

Re: Unparseable date "null"

How to handle null value in talend.I m using date data type.at the time of excel  writing i m unable to handle null value.
One Star

Re: Unparseable date "null"

How to handle null date value in talend.I m using date data type.at the time of excel  writing i m unable to handle null value.plz provide sme suggestion