Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Can someone help me with the right script for creating/adding rows in table based on start and end date.
I want to have a row for each record from the start date till the end date for the number of months. So I can create a table of the monthvalues for each contract record in time.
It is probably simple, but as a beginner, any help will be appreciated.
Thank you.
Neetha,
Thank you for your reply.
However, it is not working. Your script creates records for each day in the month. I need 1 record per month for each row in the table. Max rows is the difference in number of months.
For example, for the first record, the difference between the start an the end date is 34 months, I need than 34 records. (The amount is the monthly amount)
For the second row, the difference is 36 months, thus 36 records
For thethird row, the difference is 36 months, thus again 36 records an so on....
But each new record need to have a new column with the first day of the month.
See the post from Massimo. That is what I want to achieve.
Giovanni
The IntervalMatch() function could be what you need.
Have a look at this blog post IntervalMatch by Henric Cronström
Bill
So you want to generate dates(MMM/YYYY) and split dates monthly starting with day 1st of each as new column.
am i right?
Use IterNo function to capture dates in between start date and end date
Temp:
load * inline
[
StartDate,EndDate
01/03/2015,31/12/2017
];
TEMP1:
load
StartDate,
EndDate,
Date(StartDate+IterNo()-1) as Date
resident Temp
While (StartDate+IterNo()-1)<=Date(EndDate);
Massimo,
It seems the solution was in the filter.
Thank you very much for your help. It works now.
Neetha,
Yes that's correct.
Massimo found the solution.
It was the use of a filter in the creation of records.
where
day(month)=1;
Thanks for your help.