Hi Bubblers!
Is it possible to create an API endpoint (in my Bubble app) that calls a recursive workflow and then returns the data when the recursive workflow is complete?
I’ve seen a mention of someone potentially doing this (this post) but I haven’t been able to get it to work.
I want to process a list using a recursive API Workflow (or even Schedule a workflow on a list) and then return that processed list to my API endpoint.
Here’s my test set up:
API Workflow
Step 1:
I’m scheduling the workflow recursively and adding 1 to my-num during each loop.
The workflow will loop until my-num = 5.
Step 2:
When my-num is 5, I want to use Return data from API to return the result.
API Endpoint in the API Connector
The result
It seems to initialize successfully, but returns an empty object (json? not sure what the thing in the curly braces is)
I’m guessing that, because this is a recursive workflow, when I call the API endpoint and it returns a response, it is returning something empty since the recursive workflow has not finished yet.
Is it possible to either
- make it wait for a response or,
- send out the response when it has completed the loops?
Would option #2 be like creating a webhook? Can I do that in Bubble?
Thanks reading this long post and thank you for any ideas or suggestions (even just let me know if it’s possible so I can keep going - or if not possible and I should abandon this path )!
You cannot do this with the way you currently have it set up because the Return Data Step will technically only be returned and available to the point where your number was 4 if that makes sense. When/Where are you calling the recurring workflow to start and also when/where do you need the result?
I have a list to display on a page in my app. I need to run calculations on subsets (groupings) of the list and return the calculations to the page.
On the page I have an “outer” repeating group that takes that list as a data source and uses “groupby”.
Inside that outer (:groupby) repeating group, I have a second “inner” repeating group that takes the same list but the search is constrained by the current cell’s grouping of the outer table so that it only shows the subset.
I want to display the results of the recurring workflow in each cell of the outer repeating group - it is sort of like a subtotal.
I’ve already implemented it using the database, but it’s too slow (and my current set up prevents me from adding some other features that I need).
AAPL (Grouping in outer table)
Inner Table:
- aapl 1 (current cell’s in inner table)
- aapl 2 (current cell’s in inner table)
- aapl 3 (current cell’s in inner table)
—need subtotals and other calculations (from recurring workflow here)
IBM (Grouping in outer table)
Inner Table:
- ibm 1 (current cell’s in inner table)
- ibm2 (current cell’s in inner table)
- ibm 3 (current cell’s in inner table)
—need subtotals and other calculations (from recurring workflow here)
Just a quick update - I had an amazing reply from Bubble support on this topic. Once I am able to fully digest and implement his suggestions, I’ll post the solution here.
2 Likes