cancel
Showing results for 
Search instead for 
Did you mean: 

WORKING OF FOR NEXT LOOP

former_member1231563
Participant
0 Kudos

Hi ALL,

I am having some problems while dealing with FOR NEXT LOOP.

I am getting some data from a table throgh a repeater,For each value of the REPEATER which is a mathematical expression i am executing a FOR NEXT loop to evaluate something.

I am checking for spaces through a condition block.As soon as i get the Last space in the expression i am putting BREAK=true otherwise some other operation is to be performed.

Till here it serves the purpose.But the problem is that once it breaks it never again goes into the FOR NEXT loop for other REPEATER values.

What i want is that after it breaks it should again loop for the next REPEATER value as should be the case as far as i think.

I am not getting why it is not getting inside the FOR NEXT loop once it breaks.

Can any one please explain why is it happening and whats the way to serve the purpose consedering that it is neccassary for me to BREAK the loop.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Praveen,

when you set the property BREAK to true on the LoopNext, they will only break the LoopNext. The

main thing here is, that you have to set the BREAK on the LoopNext after leaving the iteration back

to false. A BREAK of the LoopNext will not break the Repeater.

BR

Pedro

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Praveen,

BREAK command in MII works in a different manner if compared with the various programming languages. Long time back I also thought that it would behave in the same manner as it works for the other languages.

When you put a BREAK on certain condition it breaks your NEXT loop as well as your REPEATER loop and hence will not have any further iterations on your REPEATER.

The way out here is to take a local variable and set and reset its values accordingly to meet your requirements.

To elaborate considering your scenario, take a local variable X set to 1 and refer the screenshot

Hope this helps!!

Best Regards,

Anuj

austin_jacob
Explorer
0 Kudos

Hi Praveen,

I am not sure about the behavior of For Next Loop under the Repeater. But, you can indirectly try this to break the For Next Loop Alone.

Assign CurrentItem Property of For Next Loop action with To Property(instead of assigning break to true), on the same condition when you want to break the For Next Loop.

Regards,

Austin