Hello,
I have a rather fast question:
I’m using backend workflows to treat list of data,
The workflows are recursive
I have to loop them and increment a key to go through my entire list of data.
My problem is that I need the second API workflow to be executed only when the first one’s loop has ended. Because the second one is treating data that the first one has parsed.
I tried multiple delaying methods but I can’t find a clever answer to that.
I can’t put a timer either because I cannot be sure of the time the first API workflow is gonna take.
Any idea or information would be gladly appreciated !
Thanks a lot
I have tried with a really small delay (1sec) and it seems like all of my tests worked for now
As long as the 2 API Workflows don’t start at the exact same time, it seems to work (for now)
2 ideas come to mind:
- triggers
- create one recursive workflow per record
1. Triggers
Instead of depending on scheduling API workflows, could you create a database trigger that starts when the first step is completed?
2. Recursive
This is normally how I solve for these. Here’s how I normally think of them:
- Loop takes a list of things (records in your case?)
- Takes the first item of that list, processes it
- Schedules itself again with the
list of records minus item #1
The Loop workflow should not include any calls to other workflows. Are you able to transform those 2 workflows into Custom Events instead? Custom Events will run in sequence while API Workflows will not.
Thanks for your answer
Triggers
I used a block at the end of the loop of the 1st API workflow that settles a Yes condition
When this yes condition is met, the 2nd should start but if the condition isn’t matched when I launch my workflow then it will just skip the 2nd API workflow and ignore it rather than start it when the condition is matched, if I’m clear.
Recursive
Loop takes a unique element, that is filled with a list of dates
The problem is that the list of dates is empty at the beggining of the 1st workflow
It is only filled when it has ended, your recursive method might take less time to process but won’t help me triggering the 2 API workflow after the list if finally completed.
I’m not really familiar with custom events yet, I should work on that.
To explain in a more detailed view
I receive a date range from a DateTimePicker
The first API workflow separates the range into a list of days that compose this range
The 2nd API workflow creates daily elements for each day of this particular list.
if you use a recursive workflow but also a counter, you can pass the initial list always, using the iteration to know which part of list to use, and then the modified list where always 1 item is removed from it. would that work?
triggers with that Rico means backend triggers that watch a field change.
ie not an api workflow but also found under backend workflow.
Re,
I managed to only use one API workflow and play with 2 loop increments
(also noticed that lists start at 1 in bubble and not 0 like many other languages).
My problem is solved for now, but any other answers might be useful for other purposes !
I still find really difficult to find the appropriate trigger in bubble…
Especially when you have some coding skills in mind