Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to put a loop on a LOAD statement with the following requirements:
Example:
Assume:
Startdate: 2013-01-01
End date: 2013-11-07
Values I want to generate in the first loop:
vSDate: 2013-01-01
vEDate: 2013-01-31
Values I want to generate in the second loop:
vSDate: 2013-02-01
vEDate: 2013-02-28
etc etc..., ending with in the last loop:
vSDate: 2013-11-01
vEDate: 2013-11-30
I was able to do this crawling through the loop day by day, using the formula below, but I'm unable to do the same to loop through the months:
for zi = date(vStartDateGA,'YYYY-MM') to date(vEndDateGA,'YYYY-MM')
Let zDate = Date(zi,'YYYY-MM-DD');
let eDate = MonthEnd(date(zi,'YYYY-MM-DD'));
next
Any help would be greatly appreciated.
Kind regards,
Christophe
SET DateFormat='YYYY-MM-DD';
LET vStartDateGA = '2011-10-01';
LET vEndDateGA = '2013-12-01';
do while vStartDateGA <= vEndDateGA
Let zDate = MonthStart(date('$(vStartDateGA)','YYYY-MM-DD'));
let eDate = MonthEnd(date('$(vStartDateGA)','YYYY-MM-DD'));
let vStartDateGA = date(AddMonths('$(vStartDateGA)',1),'YYYY-MM-DD');
loop
SET DateFormat='YYYY-MM-DD';
LET vStartDateGA = '2011-10-01';
LET vEndDateGA = '2013-12-01';
do while vStartDateGA <= vEndDateGA
Let zDate = MonthStart(date('$(vStartDateGA)','YYYY-MM-DD'));
let eDate = MonthEnd(date('$(vStartDateGA)','YYYY-MM-DD'));
let vStartDateGA = date(AddMonths('$(vStartDateGA)',1),'YYYY-MM-DD');
loop
Do you mean variables or fields? If you create a loop that changes the value of a variable in each iteration then after the loop ends you will still have only one variable that will have only one value.
Actually, why don't you start by explaining what your source data is and what the end result is that you're looking for.
This will always be true so the loop never ends: do while vStartDateGA <= vEndDateGA
Worked like a charm ! Thanks !
I´m overriding it inside the loop
let vStartDateGA = date(AddMonths('$(vStartDateGA)',1),'YYYY-MM-DD');