Five Stars

Check date in a particular date range using tmap filter

How do I check if a Date exists within a specific date range?

I am joining a pipeline which comes from jdbcInput--> tmap1--> tMap_join -->tOutputExcel
For tMap_Join : I am joining a SQL DB table with tMap1 out result. all dates column are in 'yyyy-MM-dd' format.

I need to check : tmap1.st_dat  >= sqlTable.st_dat AND tmap1.end_dat  <= sqlTable.end_dat

in tmap_join filter area.

 

How do i achieve this??
Attaching screenshot for this.


Regards,
Mohit
1 ACCEPTED SOLUTION

Accepted Solutions
Five Stars

Re: Check date in a particular date range using tmap filter

I have check the data and write condition below for this:
(TalendDate.compareDate(tmap1.st_dat, sqlTable.st_dat ==1 || TalendDate.compareDate((tmap1.st_dat, sqlTable.st_dat) ==0) &&
(TalendDate.compareDate(tmap1.end_dat, sqlTable.end_dat) ==-1 || TalendDate.compareDate((tmap1.end_dat, sqlTable.end_dat)) ==0)

 

We can understand TalendDate.compareDate by this :
Date1 < Date2   :  Returns -1
Date1 = Date2   :  Returns 0
Date1 > Date2   :  Returns 1

 

Above condition works for me.


Regards,
Mohit
2 REPLIES
Moderator

Re: Check date in a particular date range using tmap filter

Hello,

Could you please elaborate your case with an example with input and expected output values?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: Check date in a particular date range using tmap filter

I have check the data and write condition below for this:
(TalendDate.compareDate(tmap1.st_dat, sqlTable.st_dat ==1 || TalendDate.compareDate((tmap1.st_dat, sqlTable.st_dat) ==0) &&
(TalendDate.compareDate(tmap1.end_dat, sqlTable.end_dat) ==-1 || TalendDate.compareDate((tmap1.end_dat, sqlTable.end_dat)) ==0)

 

We can understand TalendDate.compareDate by this :
Date1 < Date2   :  Returns -1
Date1 = Date2   :  Returns 0
Date1 > Date2   :  Returns 1

 

Above condition works for me.


Regards,
Mohit