Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts
I wrote the following code with LOOP logic with WEEK to split the load volumne. Executing the script the loop is completely ignored, no data are loaded. Any ideas how to correct the script?
Main area:
// calculate last 2 month and current month:
Let vLoadDateStart = MonthStart(makedate(Year(today()),Month(today())-2));
Let vLoadDateEnd = MonthEnd(Today());
Start Loop:
Set vLoadDate = $(vLoadDateStart);
Do while vLoadDate < vLoadDateEnd
Let vLoadWeek = Week(vLoadDate);
Loading script:
Load * from
.....
VARIABLES (
[NAME=0CALWEEK, SIGN=I, OPTION=EQ, LOW=$(vLoadWeek)],
) //0CALWEEK has the format YYYYWW
Loop end date:
let vLoadDate = week('$(vLoadDate)')+1;
loop
I'd suggest running in debug mode and seeing what gets populated / handled correctly and what does not.
Off the top of my head, the first variable is clearly incorrect. Month(Today()) -2 results in negative 1 (January = 1, and then subtract two). Use AddMonths() instead of subtraction.
Thanks, can you please send the AddMonths code for the first part? Thank you.