[resolved] Date generation

One Star

[resolved] Date generation

Hi,
I am new to Talend and I would like to generate date dimension table starting from 1900.

Here is the output I need.
01-01-1990
01-02-1990
01-03-1990
01-04-1990
.
.
.
.
.

12-31-2010

Please let me know how I can generate these dates in Talend.

Thanks in an advance.

-Venkat
Community Manager

Re: [resolved] Date generation

Hello
You can use TalendDate.addDate(Date date, int nb, String dateType) provided by Talend,
here is an example, please see my screenshots.
value of mydate:
TalendDate.addDate(TalendDate.parseDate("dd-MM-yyyy","31-12-1899"),((Integer)globalMap.get("tLoop_1_CURRENT_VALUE")),"dd")

here 31-12-1899 is the init date.
result:
Starting job forum7626 at 11:23 05/08/2009.

01-01-1900
01-02-1900
01-03-1900
01-04-1900
...
12-28-2010
12-29-2010
12-30-2010
12-31-2010
Job forum7626 ended at 11:24 05/08/2009. [exit code=0]
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Date generation

shong,
Thanks for your response. I have completed the task with the help of your post.

Regards,
-Venkat
Four Stars

Re: [resolved] Date generation

shong wrote:
Hello
You can use TalendDate.addDate(Date date, int nb, String dateType) provided by Talend,
here is an example, please see my screenshots.
value of mydate:
TalendDate.addDate(TalendDate.parseDate("dd-MM-yyyy","31-12-1899"),((Integer)globalMap.get("tLoop_1_CURRENT_VALUE")),"dd")

here 31-12-1899 is the init date.
result:
Starting job forum7626 at 11:23 05/08/2009.

01-01-1900
01-02-1900
01-03-1900
01-04-1900
...
12-28-2010
12-29-2010
12-30-2010
12-31-2010
Job forum7626 ended at 11:24 05/08/2009. [exit code=0]


Hi, I need to create a fact table with more than 1500 values. If I use that example, it takes a lot of time. I tried to do this with a tRowGenerator and the predifined function addDate. But I get always the same date (my beggining date+1)

How can I use the tRowGenerator, the addDate function to create a sql table with all the dates between 2006-06-15 and today, for example? It's to have a quicker job ;-)

I use the 3.2.2-r33000 version of TOS. I get the same result with the 3.2.3

Thanks in advance for your help,

P.S I'm not a java developper....

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Have you checked out Talend’s 2019 Summer release yet?

Find out about Talend's 2019 Summer release

Blog

Talend Summer 2019 – What’s New?

Talend continues to revolutionize how businesses leverage speed and manage scale

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog