Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I've below code in my load script.
LET vFiscalPeriodID=If(Month(now())=1,Year(Now())-1&'.012',Left(Year(Now()),4)&'.'&right(1000+Month(Now())-1,3));
//vFiscalPeriodID='2016.012'
LET vFiscalPeriodID2=Replace('$(vFiscalPeriodID)','.','');
LET vFiscalYear=left($(vFiscalPeriodID),4);
LET vExchangeRateYear=$(vFiscalYear);
LET vCurrentMonth = Month(Now())-1;
LET vNextMonth = num(Month(Now()));
For p=1 to 12;
LET vCY_loop= $(vFiscalYear)*1000+$(p);
LET vCY_loop2= left($(vCY_loop),4)&'.'&right($(vCY_loop),3);
LET vLY_loop= ($(vFiscalYear)-1)*1000+$(p);
LET vLY_loop2= left($(vLY_loop),4)&'.'&right($(vLY_loop),3);
LET vPeriod_loop = right($(vCY_loop),3);
For p1=3 to 12;
LET vCY_loops= $(vFiscalYear)*1000+$(p1);
LET vCY_loops2= left($(vCY_loops),4)&'.'&right($(vCY_loops),3);
LET vLY_loops= ($(vFiscalYear)-1)*1000+$(p1);
LET vLY_loops2= left($(vLY_loops),4)&'.'&right($(vLY_loops),3);
LET vPeriod_loops = right($(vCY_loops),3);
If $(p)<=$(vCurrentMonth) then
Test:
Load *, Current
from [..../test.xlsx] where [Fiscal Period] = [$(vCY_loop2)];
STORE Test INTO [..\..\Test_$(vPeriod_loop).QVD] (QVD);
Drop table Test;
End if;
If $(p1)>=$(vNextMonth) then
Test2:
Load *, Later
from [..../test.xlsx] where [Fiscal Period] = [$(vCY_loops2)];
STORE Test2 INTO [..\..\Test_$(vPeriod_loop).QVD] (QVD);
Drop table Test2;
End if;
next p;
next p1;
The output I'm looking for the first IF statement it has to start the loop from '1' and has to end at '2' where it creates two QVD's and the second IF statement it has to start the loop from '3' and has to end at '12' where it creates 9 QVD's. But for now for the first and second IF statements it is creating only 1 QVD and ending the loop and receiving error message.
Next p
Error:
End if
Error: The control statement is not correctly matched with its corresponding start statement
@PrashantSangle @tresesco can you help me with this?
Hi @vikasshana ,
Because the p1-loop is nested in the p-loop, I'd say that you'll have to switch "next p" and "next p1".