Do it in a page. (Client side.). You’ll need Toolbox. Put a JavaScript to Bubble element on the page. Set its type to integer. Set its trigger and return value options to checked.
Set its function name to whatever you want. But I’d recommend index or countdown or something because what we’re doing is making a loop. (You’re going to trigger this thing with bubble_fn_whatever(some_value_to_send); )
Create an element or workflow that downloads all of your objects with the starts and ends to the page. For example, on page load set some custom state equal to do a search for all of those things. You could instead put an RG down that has that same source. Basically, you need a way to refer to the things by item number.
Create a workflow based on “A JavaScript to Bubble’s event”. (The one we just made.) it should run Only When… this JavaScript to Bubble’s value > 0.
The workflow steps will do this:
Step 1:
Make changes to a thing. Which thing? The list of things:item #This JavaScript to Bubble’s value.
Change the “duration” field to what you need. I’d recommend using the “date interval” type for your duration field as that’s exactly what date intervals are: time intervals, aka pure time measures, aka durations. Then the duration is This things end - this things start.
Step 2:
A Run JavaScript action with code:
bubble_fn_whatever(This JavaScript to Bubble element’s Value - 1);
Congratulations, you just made a while loop in Bubble.
That’s it for the workflow.
Now you just need to kick off this countdown.
Make a button on the page. When the button is clicked have it execute a Run JavaScript action with code:
bubble_fn_whatever(Your list of things:count);
So what’s going to happen is you’re setting the JS to Bubble element’s value to the number of the last item in your list.
Doing that kicks off that JS to Bubble element workflow. It will operate on the last item in your list of things. The JS to B’s value is then decremented. That kicks off the workflow again. This time operating on the second to last item in the list.
And so it proceeds until the JS to Bubble’s value is zero and the workflow will not execute.
This is the general approach to iteration I’ve hinted at before but never fully described.
Now, there’s little chance you’ll get this configured exactly right the first time you try. Using additional console.log functions in your Run JavaScript elements will help you see what’s going on. (In the dev console, of course.)