Six Stars

Whether it is possible to create calendar table using tRowGenerator

Hi Talend Folks,
                       I need to create below structure calendar table using tRowGenerator component. 
Whether it is possible or not?
 
Calendar Table :
Date Key (8 digit Numeric)
Cal Date (Date Format) (eg. 8JUNE2017)
Year (eg 2017)
Fiscal Year (eg.2017)
Month (eg. June)
Cal Month Num (eg. 6)
Cal Week Start Date (eg. 5JUNE2017)
Cal Week End Date (eg. 10JUNE2017)
Week (1 to 52) (eg. W1)
Cal Week Num (within Month) (eg. W1- W5 and resets to W1 with start for new month)
Day Name (eg. Thursday)
QTR Num (eg. Q2)
QTR Start Date (eg. 01APR2017)
QTR End Date (eg.30JUN2017)
3 REPLIES
Employee

Re: Whether it is possible to create calendar table using tRowGenerator

Hi,

 

You can use a tRowGenerator to generate a list of dates of your choosing, then use a tMap to create all the derived fields from that date. 

 

Screenshot from 2017-07-26 14-52-44.png

 

I'm using context to define the start date (Date type) and number of days to generate.  Then generating a sequence and adding that to the date for each generated row. 

 

Then in your tMap, just calculate the rest as needed: 

Screenshot from 2017-07-26 14-55-49.png

Six Stars

Re: Whether it is possible to create calendar table using tRowGenerator

 Thank you mverrilli

I appreciate for your response.I also completed 8 columns. completed columns are given in screenshots.

Screenshot (925).png

could please tell me?. How to create below column also?
1) Fiscal Year (2016-2017)
2) Cal Week Start Date (eg. 5JUNE2017)
3) Cal Week End Date (eg. 10JUNE2017)
4) Cal Week Num (within Month) (eg. W1- W5 and resets to W1 with start for new month)
5) Quarter Start Date (eg. 01APR2017)
6) Quarter End Date (eg.30JUN2017)
7) Fiscal Month
8) Fiscal QTR

Ten Stars

Re: Whether it is possible to create calendar table using tRowGenerator

You'll need to do date math. It may be easiest to create some routines to do the calculations. Stackoverflow has articles on how to calculate various dates based on a Java date.