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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to write if and else condition check for the date pattern in tMap

Hello all

 

I have a requirement like below

 

Date1Date2
6/2/20187/2/2019
null7/25/2019

 

If the Date1 is null i need to populate the value from Date2 in the target

If the Date1 is not null i need to populate the value as current date in the target

 

My expected output column

output
today's date (11/03/2019)
7/25/2019

 

 

Thanks In Advance

Manish

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

row1.date1 == null ? row1.date2 : TalendDate.formatDate("MM/dd/yyyy", TalendDate.getCurrentDate())

View solution in original post

4 Replies
TRF
Champion II
Champion II

row1.date1 == null ? row1.date2 : TalendDate.formatDate("MM/dd/yyyy", TalendDate.getCurrentDate())
Anonymous
Not applicable
Author

Thanks @TRF 

 

Am getting cannot convert string to date error, can you please help me out how to resolve it 

 

0683p000009M7VS.png

TRF
Champion II
Champion II

Just change for this if datatype is date:
row1.date1 == null ? row1.date2 : TalendDate.getCurrentDate())
In this case formatting doesn't make sense, a date is a date...
Anonymous
Not applicable
Author

@TRF 

 

row1.date1 == null ? row1.date2 : TalendDate.getCurrentDate() i used this, so it worked out as per my need thanks @TRF