#1 2009-08-05 00:15:04

venkatk
New member
Registered: 2009-07-17
Posts: 5

[resolved] Date generation

Tags: [add, date]

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

Offline

#2 2009-08-05 05:02:30

shong
Talend team
Registered: 2007-08-29
Posts: 10350
Website

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:

Code:

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:

Code:

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]

Uploaded Images


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#3 2009-08-06 16:12:11

venkatk
New member
Registered: 2009-07-17
Posts: 5

Re: [resolved] Date generation

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

Regards,
-Venkat

Offline

#4 2010-02-15 16:40:46

olcell
Member
Company: ARDI Rhône-Alpes
Registered: 2006-10-09
Posts: 55
Website

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:

Code:

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:

Code:

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....

Last edited by olcell (2010-02-15 16:43:02)


THX,
Regards,

Olivier

Offline

Board footer

Powered by FluxBB