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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Between/AND check and pass the value

I need to check the column DATE is between 2017-01-01 and 2017-12-31. If YES, then i should pass the value as 1 to the output field. How can i do this?

 

When i gave <= and >= in tMAP, its not accepting.

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Does this help you?

If so, thank's to mark your case as solved (Kudos also accepted).

View solution in original post

6 Replies
TRF
Champion II
Champion II

Try this:

TalendDate.compareDate(row1.yourDateField, TalendDate.parseDate("yyyy-MM-dd", "2017-01-01"), "yyyy-mm-dd") >= 0 &&
TalendDate.compareDate(row1.yourDateField, TalendDate.parseDate("yyyy-MM-dd", "2017-12-31"), "yyyy-mm-dd") <= 0

Hope this helps.

Anonymous
Not applicable
Author

error. Input date field is string. Please suggest

 

Also, why its very complicated in talend just to compare two date. 

TRF
Champion II
Champion II

The example I gave you works fine for me.

Share your piece of code.

The date comparison is not "complicated" due to Talend but to Java.

Anonymous
Not applicable
Author

OK..

 

I just changed the field name from your code given and ran.

0683p000009Ly81.jpg

 

 

0683p000009Ly15.jpg

TRF
Champion II
Champion II

EncounterActivityDate field seems to be a String but should be a Date.

Have a look to TalendDate.parseDate to convert from String to Date datatype.

TRF
Champion II
Champion II

Does this help you?

If so, thank's to mark your case as solved (Kudos also accepted).