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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sudhee_Maximus
Creator
Creator

Null pointer exceptions on date column

Hi all here,

 

I have similar issue while using for date column (but even after using relational.ISNULL / .equals(null)/ Length  I am having null pointer exceptions )
*********************************************Coded as below *******  
(row2.P_SPECL_BEG_DT1.equals(null) || row2.P_SPECL_END_DT1.equals(null)) ||  --------- > checking fro null column 
(StringHandling.LEN(row2.P_SPECL_BEG_DT1.toString())==0 || StringHandling.LEN(row2.P_SPECL_END_DT1.toString())==0 ) ---> Checking if it is not null but o chars
? null :
!(TalendDate.isDate(row2.P_SPECL_BEG_DT1.toString(),"MM-dd-yyyy") && TalendDate.isDate(row2.P_SPECL_END_DT1.toString(),"MM-dd-yyyy"))? null :  --->checking if it is not desired date 
TalendDate.diffDate(row2.P_SPECL_END_DT1,row2.P_SPECL_BEG_DT1) < 0 ? " Error SPECL_BEG_DT1 > SPECL_END_DT1,"
:null

 

 

 

**************************** Please let me know why even after handling nulls I am having Null pointer exception ***********  did I  miss anything here ...

 

please correct my basic if I am missing any here

 

attaching sample date values  for reference .... in which highlighted are null values coming and a 3 char word is another col in b/w which is not considered .

Labels (2)
1 Solution

Accepted Solutions
cmendels
Contributor III
Contributor III

I'm not sure that I understand your requirements, but I do think you should try changing your code to (row2.P_SPECL_BEG_DT1==null || row2.P_SPECL_END_DT1==null) ? null

 

If your column is date datatype, blank values should return as null.

View solution in original post

1 Reply
cmendels
Contributor III
Contributor III

I'm not sure that I understand your requirements, but I do think you should try changing your code to (row2.P_SPECL_BEG_DT1==null || row2.P_SPECL_END_DT1==null) ? null

 

If your column is date datatype, blank values should return as null.