Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

NullpointerException and String to Date

I am doing all of these transformations in tMap.

 

Actual_Close_Date is a string data type in the data source. First I tried,

TalendDate.parseDate("MM/dd/yyyy",row.Actual_Close_Date) it gives an error:

Unparseable date: "Fri Nov 15 00:00:00 CST 2013"

Then I tried:

TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row2.Actual_Close_Date) it gives an error:

java.lang.NullPointerException

Then I tried:

row2.Actual_Close_Date == null ? 0 :TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row2.Actual_Close_Date) it gives an error:

Type mismatch: cannot convert from Object&Comparable<?>&Serializable to Date

Then I tried:

(row2.Actual_Close_Date.equals(""))||(row2.Actual_Close_Date==null) ? null : 
(TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row2.Actual_Close_Date))

 Error it gives:

java.lang.NullPointerException

I have run out of options and googlefu has dried up for me.

The format I am requesting is "MM/dd/yyyy".

How can I fix this please. Any insights would be greatly appreciated.

Labels (3)
1 Solution

Accepted Solutions
cterenzi
Specialist
Specialist

You were close!

 

This example:

row2.Actual_Close_Date == null ? 0 :TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row2.Actual_Close_Date)

...will work if you replace 0 with a valid date or the word null.

View solution in original post

1 Reply
cterenzi
Specialist
Specialist

You were close!

 

This example:

row2.Actual_Close_Date == null ? 0 :TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row2.Actual_Close_Date)

...will work if you replace 0 with a valid date or the word null.