AnsweredAssumed Answered

Nested Loops:  Stopping only the innermost loop when a condition is met

Question asked by jasheldo on Jan 30, 2016
Latest reply on Feb 1, 2016 by jasheldo

I'm working on a project and the "Exit Loop If[]" command isn't operating as I would expect it to.  I'm confident this is just me not knowing what's happening but here's an outline.

 

Go to Layout [ Original Layout ]

Go to Record/Request/Page [ First ]

Loop

     Go to Related Record [ Another Table ; Using Layout BLAH ]

     Loop

          if [ $x = 1 ]

               Set Variable [ $variable ; 1 ]

               Exit Loop If [ 1 ]

          else

               DO SOME STUFF INVOLVING $x

          end if

     Go To Record/Request/Page[ Next ; Exit after Last ]

     End Loop

Go to Layout [ Original Table ]

Go To Record/Request/Page [ Next ; Exit After Last ]

Set Variable [ $x ; 0 ]

End Loop

 

More or less this is what I'm doing.  What I'm noticing is the "Exit Loop If" above is exiting both loops.  I need to only make the inner loop end and continue operating the outer loop.  In order to verify this behavior I ran through the script debugger and sure enough when the "Exit Loop If" line was executed it left both loops.  If this is truly a trivial thing and I'm not privy to a very obvious function (e.g. Halt Script vs Exit Script ) please just let me know what I need to use instead of "Exit Loop If".

 

Thank you.

Outcomes