create a calendar table

Four Stars

create a calendar table

Hello,
I will try to explain myself, I'm a newbie with TOS DI and I'm trying to create a table wich will provide me a calendar for future maintenance events.
I have a table which contain future maintenance activities (maint) with the next execution date (nextdate) and a frequency (freq) and unit frequency (frequnit)
for example
MAINT    |  NEXTDATE  | FRQ | FREQUNIT |
MAINT1  |  01/06/2015 |  1    | MONTH    |
The result should be a list of all maintenance date for n months (for example 12M)
ID  | MAINT    |  CALCNEXTDATE 
1   | MAINT1  |  01/06/2015
2   | MAINT1  |  01/07/2015
3   | MAINT1  |  01/08/2015
4   | MAINT1  |  01/09/2015
5   | MAINT1  |  01/10/2015
6   | MAINT1  |  01/11/2015
etc...
What should I use for having this output.
In advance thanks,
One Star

Re: create a calendar table

Hi lhamlein,
Interesting scenario. Smiley Happy
This is what I've come up with:
1. We'll need to have 2 flows, one from the source file reading the above mentioned record; & the second from a tFixedFlowInput component where we'll create the no of iterations we need (n, as per your above post)
2. These 2 flows would merge in a tMap, as shown below:

where 'nxt_date' column gets its value as:
TalendDate.addDate(row2.nxt_date,"dd/MM/yyyy",row4.repeatations,"MM")



output:

Hope this helps. Smiley Happy
MathurM
Four Stars

Re: create a calendar table

It works but I have used TalendDate.addDate(row3.NEXTDATE,row4.repeatations*row3.FREQUENCY ,"MM")   .
as my fields are dates
thanks,
Four Stars

Re: create a calendar table

hello,
my problem now is that I have 3 types of frequency unit weeks, month, year.
So if repeating 52 times for the weeks is ok and give me all occurence between now and now+52weeks.
For a frequency "year" it repeats it for the next 52 years, which create to many occurence for what I need.
Is there a way to have 3 different calculation based on the frequency unit.
My iterator will be in Year.
Case frequency= 'weeks' then TalendDate.addDate(NextDate.NEXTDATE,iterator.iterator*365*NextDate.FREQWKS,"dd")
Case frequency ='month' then TalendDate.addDate(NextDate.NEXTDATE,iterator.iterator*12*NextDate.FREQUENCY,"MM")
Case frequency ='year' then TalendDate.addDate(NextDate.NEXTDATE,iterator.iterator*NextDate.FREQUENCY,"yyyy")
Thanks,