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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to pass blank String Date to output in tMap

Hello Talend Community,

 

I know there has been a few posts about this, but I still can't find the proper syntax in my tMap Output Column for a String Date Column having "" blank values. I've tried a lot of variations on this syntax and still no luck. I'm also formatting the string date into a new format after handling the NULL and blank values. The Java Run Time Error I'm getting is

java.lang.RuntimeException: java.text.ParseException: Unparseable date: ""

 

"".equals(row1.Mail_date) || row1.Mail_date == null ? "" : TalendDate.formatDate("yyyyMMdd",TalendDate.parseDate("MM/dd/yyyy",row1.Mail_date)) 

Can anyone in the community help me with this syntax

 

-Andrew

 

Labels (1)
1 Solution

Accepted Solutions
cmendels
Contributor III
Contributor III

Try row1.Mail_date==null || row1.Mail_date.length()==0 ? ""

View solution in original post

5 Replies
fdenis
Master
Master

your date have to be date type allowing null value.
(row1.Mail_date != null)?TalendDate.formatDate("yyyyMMdd",row1.Mail_date):""
if your date is on text format, you have to be sure of your format. did you have blank char into Your String?
Anonymous
Not applicable
Author

@fdenis

 

So should I make a Variable TalendDate.parseDate("yyyyMMdd",row1.Mail_date) to change my Source Data to Date Type and then use your statement below as the output to the column?

(row1.Mail_date != null)?TalendDate.formatDate("yyyyMMdd",row1.Mail_date):"

 

I didn't understand your question did you have blank char into Your String?

 

I do have Blank Source Data that needs handled with a tMap Expression.

 

Let me know thanks!

 

fdenis
Master
Master

work by steps one tmap to remove blank.
one to change strign to date.
step by step:
test your first tmap output with no blank date format are all the same. (you can use tlog to show datas)
add your second tmap with formating.

after that you can optimise all in one tmap
cmendels
Contributor III
Contributor III

Try row1.Mail_date==null || row1.Mail_date.length()==0 ? ""

Anonymous
Not applicable
Author

Thanks @cmendels @fdenis for the assistance