Could someone explain what is a "recursive workflow", please?

Dear all,

I often read “recursive workflow” in this forum. OK great, so I search for a way to build such a recursive Workflow, but I have found any way to…

For me, recursive stands for… recursive, aka a kind of “while” loop, or a workflow where you can apply a transformation for nested elements.

So… Wtf is a recursive workflow with Bubble?!

Thanks :pray:t2::stuck_out_tongue_winking_eye:

In Bubble, a recursive workflow is a workflow that can call itself. For example:

  1. you can send a list of users (say, 10 users) to a recursive workflow.
  2. Perform some action on the :first item of that list.
  3. :minus item the :first item from the list, to now leave only 9 users.
  4. Now call the workflow again, and send the same list (now having 9 users) , only when the number of users is greater than 1
2 Likes

Thanks @deadpoetnsp for your feedback. So yes, this way it’s recursive. I have to practice this by my own to get a clearer idea on how it works and how I can use it…

Thanks again :+1:t2:

As background …

This was not allowed until fairly recently, because it allows you to create infinite loops.

It is like “Do THIS until 5 > 9” … but that will never happen. So it will just do THIS until the end of time (well, a Server reset).

As we share resources on our Bubble apps, it will affect my if you do this and chew up the server time.

Bubble’s hand was somewhat forced on this, as a clever person realised you could ping-pong two workflows instead. A calls > B calls A > calls B etc etc

For the most part Bubble likes to know IN ADVANCE how many times you want to do something. So scheduling a workflow on a list has a known size of list so it can deal with it. Do this until hell freezes over … less so :slight_smile:

2 Likes

Yes, impacting and dangerous, I fully agree. I spent enough time years ago debugging infinite loops and memory leaks :smile:

1 Like

I was asking about recursive workflow because I let my users building their own products catalog, this catalog contains main (root) categories, subcategories and products (leaf). If the catalog is browsed from the root to the leafs, no problem to set a nav bar allowing users to navigate within the catalog. But as the products can also be accessed using a search, I’d like to find a way to dynamically display the navbar.

I haven’t spent lot of time on this feature for the moment, and recursivity is what I need to be able to get a navbar for this use case. Need to go deeper on this topic!

1 Like

Hey @NigelG

Does bubble allows a logic like check status of a task every 1 or 2 second (from a third party server using API call ) until it becomes completed/successfull?
Additionally, is there an option to specify that after sometime say 15 sec to stop checking the status?

So, basically running a while loop with an exit condition or until the call times out (where we can decide the timeout time).

Regards
Chirag

No natively no. You could potentially watch a field via an API, but you can’t check to see if something is running directly.

This topic was automatically closed after 70 days. New replies are no longer allowed.