BreakCondition on "For Each" element

By Johan den Ouden on 17 May (6 days ago)

When you use a "For each" element it would by very nice to set a breakcondition.

Imagine I have 1000 records and need to find a specific record.

In the loop it would be verhy handy to set a variable IsFound to true and check this  on the next interation ofthe loop.

If the records was found on iteration 2 there is no need to iterate the other 998 iterations.

 StopLoop.JPG
Curt Raddatz17 May (6 days ago)

What you are describing is a conditional breakpoint which has been on the idea list for a long time.  Here's the link -
https://www.outsystems.com/ideas/66/conditional-breakpoint - please like that one.

Johan den Ouden17 May (6 days ago)

Oke thanks!

Nuno Maurício18 May (5 days ago)

Hi Curt,

I don't think that Johan is talking about that.

He means that we should be able to set a condition in ForEach node that will not keep iterating when that condition match.

The other idea is for debugging purposes. This one is not. This one is for runtime itself.

Am I right?


Cheers.

Johan den Ouden18 May (5 days ago)

Nuno,

You are absolulty right!
Thanks for your comment and I hope it will be picked up by OutSystems.

J.18 May (5 days ago)

there is a similar idea, regarding whiles I believe.


tbh, I don't like the fact you should break out of a for-each loop, because then for-each is not correct naming.

I prefer a new "node" while. :P


Johan den Ouden18 May (5 days ago)

Why not both?


In c# you can also break a in a for each loop.

J.22 May (22 hours ago)

Hmm,

For some reason I was under the impression, you want to breakout inside the for-each-loop whereever you could.

But if you mean like this:

Johan den Ouden22 May (20 hours ago)

Yes that is want I meant

The check must be done everytime your on the for eacht widget again