Page 1 of 1

Nested WHILE loops?

Posted: Mon Jul 21, 2014 5:08 pm
by glittle
Hello

I have a quick question; is it possible to use nested WHILE loops in Turbo Integrator?

This post implies it is... http://www.tm1forum.com/viewtopic.php?f=3&t=348#p16842

... but when I try to run this process as a test:

Prolog:

Code: Select all

#****Begin: Generated Statements***
#****End: Generated Statements****

x = 1; 
y = 1;

WHILE ( x <= 12);
   WHILE ( y <= 12);
    ASCIIOutput('D:\TM1\Files\TimesTables.csv' , NumberToString( x) | ' times by ' | NumberToString( y) | ' is ' | NumberToString( x * y) );
    y = y + 1;
   END;
   x = x + 1;
END;
I get the attached output...
TestOutput.png
TestOutput.png (6.18 KiB) Viewed 5794 times

Re: Nested WHILE loops?

Posted: Mon Jul 21, 2014 5:19 pm
by declanr
Yes its possible.

The reason you don't get multiple loops through the output is you're failing to reset your inner counter back to 1 for further passes.

Re: Nested WHILE loops?

Posted: Mon Jul 21, 2014 5:25 pm
by glittle
So I'm not.

Thanks for the fast response.

Re: Nested WHILE loops?

Posted: Mon Feb 23, 2015 4:22 am
by FragaA
declanr wrote:Yes its possible.

The reason you don't get multiple loops through the output is you're failing to reset your inner counter back to 1 for further passes.
Resetting the counter was certainly the solution to our own issues with the while loops. Thank you very much for this.