Stopping a loop inside a workflow

Using the iterator (for loop) in workflow, I set up a loop to keep fetching a collection until:

  • a specific condition from the fetched collection is met OR
  • a variable (that I increment during every iteration of the loop) has reached a certain value

This article talks about a Stop iterator action, but I couldn’t find this action inside my workflow builder?. Any idea if WeWeb stopped supporting this action recently? I couldn’t find any docs.

I also tried using a “Pass through condition” to achieve breaking out of loop. I tried setting it up in 2 different ways: to break out if the “Pass through condition” is TRUE, and also tried setting up if the
Pass through condition" is FALSE. Neither of these 2 approaches worked. I could see the condition being TRUE or FALSE in the workflow builder, but the breaking out of the loop didn’t happen. In general, I couldn’t find any good documentation of what a “Pass through condition” does or doesn’t.

Could someone please help?

Hi @sonnykane :wave:

Indeed the stop action was removed when we added the pass through conditions and branches to workflows. We might put it back depending on the use cases that people tell us about.

In the meantime, I think what you’re trying to do can be achieved with a pass-through condition.

Here’s a video showing how it might work. Sorry it’s a big long because I was thinking out loud :smile:

Does that help?

Don’t hesitate to let me know if not. I’ll be updating the user docs asap with a current use case. Thanks for bringing it to our attention!

1 Like

Thanks @Joyce . Love that you took the time to record the video and respond this quick.

After watching the video, I noticed that you placed the “Pass through condition” element/ action block right at the beginning of the for loop, whereas I had it towards the end of the loop (as a check to decide if a subsequent iteration of the loop is needed).

To validate :point_up:, please try moving the “Pass through condition” in your demo example to just after your “Return” block in the screenshot below. The loop should continue irrespective of the pass through condition being FALSE/ TRUE.

If you’re able to validate this, I think it’s worth adding either as a bug or a feature explanation (if it was intended this way) in the notes.

image

Thanks a bunch again!