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

Date Column null validation

Hi,

 

Can anyone say how to do validation for the below requirement?

 Loading from excel to Oracle table.

In excel If date column is null or empty, I want to insert sys date into the oracle table. 

Excel ---->tmap---> OracleOutput

in tmap source date column is Date type and Target date column is also Date type.

 

 

 

Labels (2)
5 Replies
Anonymous
Not applicable
Author

Hi All,

 

row1.CREATION_DATE == null? TalendDate.getCurrentDate(): row1.CREATION_DATE 

this code is working fine for date type to date type.

 

But If I want to check empty it is not working:

row1.CREATION_DATE == " "? TalendDate.getCurrentDate(): row1.CREATION_DATE 

 

Is it possible to check for empty?

Anonymous
Not applicable
Author

This is the simplest way to handle nulls assuming you are getting dates in the proper format.

input_row.dateColumn==null||input_row.dateColumn.toString().trim().length()==0?TalendDate.getCurrentDate():input_row.dateColumn

brama
Contributor III
Contributor III

In tMap use like below. Try either in variables or in the output column derivation.

DateCol==null?TalendDate.parseDate("yyyy-MM-dd HH:mm:ss", TalendDate.getDate("yyyy-MM-dd HH:mm:ss"))0683p000009MACJ.pngateCol

OR

DateCol==""?TalendDate.parseDate("yyyy-MM-dd HH:mm:ss", TalendDate.getDate("yyyy-MM-dd HH:mm:ss"))0683p000009MACJ.pngateCol

Thanks

SachinD
Creator
Creator

 

Please add Variable in tMap

(row14.Date.equals("null") || row14.Date.equals(""))? TalendDate.getDate("yyyy-MM-dd") : row14.Date 

 

0683p000009Lv6L.png

 

 

Anonymous
Not applicable
Author

Hi,

@ArvinRapt : Thank you! your method is working fine.

 

@rchinta and @SachinD as my data type for both source and target is DATE data type so your  method is not working, maybe it works for string to string 

 

Thanks to all.