how to compare date in talend

how to compare date in talend

hi,
I have a input date(As KEY) and a lookup file
the lookup file has two colomn start_date and end_date on the basis of these two colomn
we have to update a,b and c
THE senario is like this if my input date fall on the range of these two colmn's of lookup file we have to update a,b and c
input date :28-07-2003
lokup file:
start date end date a b c
28-06-2003 25-07-2003 200307 3 2003
01-01-2010 29-01-2010 201001 1 2010
26-09-2015 30-10-2015 201510 4 2015
28-03-2009 24-04-2009 200904 2 2009

how could i do this please give the solution
thank you in advance.
kind regards
Shailendra s.
One Star

Re: how to compare date in talend

Hi Shailendra,
you can use the tIntervalMatch component to lookup the date in the ranges (check the help-file for more info).
regards,
Walter.
One Star

Re: how to compare date in talend

Hi Shailendra,
step 1. Take lookup start date
step 2. do increment in loop till end date
step 3. check whether date is equivalent to input date or not
Tjava
long l =TalendDate.diffDate(end_date, start_date);
globalMap.put("iterate", l);
tLoop:
select : for
from : 0
to: (Long)globalMap.get("iterate")
step:1
tjava:
context.date =
TalendDate.addDate(context.start_date,"dd-MM-yyyy",((Integer)globalMap.get("tLoop_1_CURRENT_VALUE")),"DD");
System.out.println("DATE " + context.date);
TalendDate.compareDate(end_date, start_date,"dd-MM-yyyy")==0 ? Match : not match