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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
HMolitor
Contributor
Contributor

NullPointer Exception with TalendDate.FormatDate()

Hello,

my source is an excel sheet where I have a column which is obviously a date, so in the schema in talend I defined that column as date.

In tMap I want to convert it to a string so I do --> TalendDate.formatDate("dd-MM-yyyy", row1.mydate) and get the following error :

java.lang.NullPointerException

at java.util.Calendar.setTime(Calendar.java:1770)

at java.text.SimpleDateFormat.format(SimpleDateFormat.java:943)

at java.text.SimpleDateFormat.format(SimpleDateFormat.java:936)

at java.text.DateFormat.format(DateFormat.java:345)

at routines.TalendDate.formatDate(TalendDate.java:129)

I tried several date patterns but it makes no difference.

Thanks in advance!

Labels (2)
3 Replies
manodwhb
Champion II
Champion II

@Hendrik Molitor​ , can you try to use the below one.

 

row1.mydate==null?null:TalendDate.formatDate("dd-MM-yyyy", row1.mydate)

 

 

Thanks,

Manohar

HMolitor
Contributor
Contributor
Author

Oh...i thought I excluded null value rows but obviously I didn`t...so this helps a lot 🙂

Thanks!!!

manodwhb
Champion II
Champion II

@Hendrik Molitor​ , you can mark the replay as Answer and like it, the one which helped you . So that it will help to others.

 

Thanks,

Manohar