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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
joe86
Contributor
Contributor

Data between two dates in Expression builder

Hi All,

I need to fetch only records between two dates. Also i need this to be written in the tMap expression builder.

I have an incoming DATE which has past and future dates. But i need to fetch only the dates that are between CurrentDay and CurrentDay+7 and rest all the dates should be ignored in my output. This has to be done in tMap expression builder.

Can someone please help on this?

Is it possible to bring in BETWEEN like function or DateDiff in Talend??

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

@joe86

 

   I have done a similar exercise in one of my earlier posts. Could you please refer my comment in the below post (6th comment), which is having code and screenshots? I hope it will satisfy your query.

 

https://community.talend.com/t5/Design-and-Development/Scenario-based-Question-in-Talend/m-p/140691#...

 

If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂

 

Warm Regards,

 

Nikhil Thampi

View solution in original post

7 Replies
Anonymous
Not applicable

@joe86

 

   I have done a similar exercise in one of my earlier posts. Could you please refer my comment in the below post (6th comment), which is having code and screenshots? I hope it will satisfy your query.

 

https://community.talend.com/t5/Design-and-Development/Scenario-based-Question-in-Talend/m-p/140691#...

 

If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂

 

Warm Regards,

 

Nikhil Thampi

joe86
Contributor
Contributor
Author

@nthampi
This worked. Thanks a lot. 0683p000009MACn.png below is the one...
TalendDate.compareDate(TalendDate.getCurrentDate(),row12.myDate)<=0 && TalendDate.compareDate(row12.myDate,TalendDate.addDate(TalendDate.getCurrentDate(),7,"dd"))<=0

When i use multiple columns using OR condition, in Expression builder, it does not work.

(TalendDate.compareDate(TalendDate.getCurrentDate(),row12.myDate1)<=0 && TalendDate.compareDate(row12.myDate1,TalendDate.addDate(TalendDate.getCurrentDate(),7,"dd"))<=0) ||
(TalendDate.compareDate(TalendDate.getCurrentDate(),row12.myDate2)<=0 && TalendDate.compareDate(row12.myDate2,TalendDate.addDate(TalendDate.getCurrentDate(),7,"dd"))<=0) ||
(TalendDate.compareDate(TalendDate.getCurrentDate(),row12.myDate3)<=0 && TalendDate.compareDate(row12.myDate3,TalendDate.addDate(TalendDate.getCurrentDate(),7,"dd"))<=0)

What i want to achieve is, if date1 is not between currentDay+7, then i have to check the same for date2 with same conditon and same for date3. what am i doing wrong here?? can u please help??
Anonymous
Not applicable

@joe86

 

   Are you getting any error? I believe you will have to verify the data of each expression separately before merging them.  An easy way is to print the output of each expression to a tlogrow and verify. I am sure you can crack it with some quick analysis 🙂

 

Warm Regards,

 

Nikhil Thampi

 

 

joe86
Contributor
Contributor
Author

@nthampi
I did not get any error as such, but this filter is not making any effect in my output. but when i use individually (one filter at a time), i am getting the desired output.
Anonymous
Not applicable

Hi,

 

   Could you please print the expression results as tmap columns and share the details here? Also add one additional column which will give the results after merging. Lets quickly check whether its processing boolean correctly. Please note that they are boolean fields and you are using an OR condition. 

 

Warm Regards,

 

Nikhil Thampi

joe86
Contributor
Contributor
Author

hey,
i am sorry, the filter is working for me. I am getting the desired output. previously, i was not getting as required. anyways, let me check for more data and see..
thanks again 0683p000009MACn.png
Anonymous
Not applicable

@joe86

 

    Yes. I would suggest to verify the data for all different conditions. Anyway, now you know how to do comparison and its just a matter of doing condition checking based on multiple boolean values. You can crack it 🙂

 

Warm Regards,

 

Nikhil Thampi