Hi there, there is clearly a error in nesting Loop-statements in Navision.
Try this (tested in Navision 4.0 SP3, build 27010):
for a := 1 to 2 do begin
for b := 1 to 2 do begin
for c := 1 to 2 do begin
for d := 1 to 2 do begin
for e := 1 to 2 do begin
test := padstr('',5,'.');
test := copystr('Test',1,2);
end;
end;
end;
end;
end;
Define a till e as integer or decimals (no difference), put the code in a Codeunit-run, in a tablefield, in a tablefunction, in a codeunit-Function... whereever you want.
Try to compile, you get the error mentioned in the headline. =D>
Both functions (test := ...) will lead to the error, much more (i.e. format(padstr) will also.
You can use this short Var-names, or even longer Var's, no difference. [-(
it seems, as the Compiler will turn into a stack-error. :bug:
If you comment the test :=... or remove one For-loop, everything will work fine, if you move 1-4 loops into an sub-codeunit, everything will work fine.
If you add another Loop, the error stays, if you delete the begin/end, where possible, the error stays. ](*,)
Did someone had this error before, and found a solution which will not need to call a sub-codeunit? :?:
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
RIS Plus, LLC
MVP - Business Apps
You not using a - e variables why not use one loop with 1 to 32 ?
You could use a loop on the integer table if you need so may loops.
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
I will agree with all comments. I have no idea why you need this? Can you give some example?
C/Side is a primitive language. "for" is probably considered too advanced for it to handle after a certain number of loops, my guess is the memory allocation is not optimized or the exe itself is never optimized even after it moved to 32 bit environments.
ERP Consultant (not just Navision) & Navision challenger