Nested WHILE loops?

Post Reply
glittle
Posts: 5
Joined: Fri Apr 25, 2014 12:18 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2010

Nested WHILE loops?

Post 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 5511 times
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: Nested WHILE loops?

Post 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.
Declan Rodger
glittle
Posts: 5
Joined: Fri Apr 25, 2014 12:18 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2010

Re: Nested WHILE loops?

Post by glittle »

So I'm not.

Thanks for the fast response.
FragaA
Posts: 1
Joined: Mon Feb 23, 2015 4:16 am
OLAP Product: Cognos TM1
Version: 10.1
Excel Version: 2010

Re: Nested WHILE loops?

Post 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.
Post Reply