Fetching tomorrow date's data (addDate function) from DB

One Star

Fetching tomorrow date's data (addDate function) from DB

Dear guys ,
I have three tables with relations. table1 , table2 and table3
Table1 fields :
t1_userid       ( Foreign key of t3_userid )
t1_appid        ( Foreign key of t2_appid )
t1_date
Table2 fields:
t2_appid (Primary Key)
t2_appname
Table3 fields:
t3_userid (Primary Key)
t3_username
Now i want to fetch tomorrow date (t1_date) data's
So i designed job like this


tjava component (add_date)
String d=TalendDate.getDate("YYYY-MM-DD");
String ad=TalendDate.addDate(d,"yyyy-MM-dd",+1,"dd");
 
Tomorrow's date i will get from tjava component (add_date)
I want to construct a output with t1_appname , t3.username and t1_date (tomorrow's date) fields
 
Help me to do this
Thanks & Regards,
Vinoth Kumar K

Re: Fetching tomorrow date's data (addDate function) from DB

Hi Vinoth,
I would suggest you to make use of global map. 
Get current date - > add a day -> put the new date in global map  and then get that value where ever you need it.
Date date = TalendDate.getCurrentDate();
Date toDate = TalendDate.addDate(date, 1,"dd");
globalMap.put("toDate", toDate);
Or if you want date as string.
String date = TalendDate.getDate("yyyy-MM-dd");
String toDate = TalendDate.addDate(date, "yyyy-MM-dd", 1, "dd");
globalMap.put("toDate", toDate);

Now in the expression field for t1_date put this 
globalMap.get("toDate")

You can use date as it is if column type is Date, you can specify the date format there.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download