Forum Academy Marketplace Showcase Pricing Features

Setting the appropriate increment to +1 on a scheduled API workflow on a list or recursive workflow

I am having a bit of a basic mind blank and could do with some direction.

The objective is to join two lists of separate entries as a new third master list of separate entries.

At a basic level it would look like this:
Screenshot 2021-06-09 at 16.27.58

After some research it seems to be that scheduling an API workflow on a list or a recursive workflow on a list would be the best option. Typically there may be 10 or 20 items on this list in my use case but it could in theory be up to 500ish depending on the user.

It’s important that this data is copied over accurately and no entries are missed. It is a process that does not need to be done on the front end and I don’t mind if it takes a few minutes to complete and compile but I do want the entries to be accurate.

Which method should I use and how do I tell the API to set an increment so it goes from the first item to the next item sequentially. I’ve tried it where all items get added to a single entry as a list and that does not work for my use case, they must be individual entries.

I’ve also tried to specify :first item but of course that just loops through and repeats the first item. What’s the thought process perhaps with some exapmle workflow screenshots on setting a +1 increment so it can work through a list to create a separate master list?

The actual lists I need to merge are booked dates and blocked dates for a property rental site.

Confirmed paid bookings shown here

Will need to be added to user blocked date ranges shown here

In a final database that is iCal compliant (can talk to other rental sites) and tell them which dates are not available to be booked.

Ultimately and perhaps this is another question, I need this workflow to trigger whenever a booking comes in or is modified or a blocked date is added or modified. The master list should only ever contain the most up to date summary of both lists combined so it can be converted to ical file via @muneer.hameer beautifully crafted iCal creator and shared with the world.

Any guidance from the bubble eco system appreciated

Many different ways to do it…one could be to have a parameter which is the list of things, and use what you attempted which is the :first item from that list, but on the recursive trigger set up the list to be the list value minus item the first items value so you just remove it from the list for the next recursive flow. Then have the conditional on the recursive trigger to only trigger when the parameter (the list) count is greater than 1.

1 Like

That sounds like the right sort of thing.

I’ve taken a few shots of my workflows as they currently stand but can’t quite connect the last couple dots

Here I’ve added the parameter as the list of things ( label: “2 User Blocked Date Ranges”)

To keep the example simple until it’s running recursively I’m just going to fill out one field from my data the “End Date” and create a new thing which is “4 iCal Output Blocked + Booked” (The soon to be Master list)

I’m referring to the list of things :first item to populate that data field.

The other field is a “List item” field I created to count: the list of things. Not sure if that’s the right approach.

Finally on the recursive trigger I need a bit of clarification on how to

I’m not sure how to specify the list value minus item the first items value. What would that look like as a workflow formula in this example??

Finally can you check whether the recursive trigger should look something like this

Any more tips or mock ups on how this should be set up are super appreciated.

Don’t set your cursor for the next iteration to be less than 3 or 4 seconds apart. You’ll experience much more reliability at 4+ seconds. Trying to do these things a second apart will max your app out and sooner or later a workflow won’t get called and it’ll stop unexpectedly.

This does mean you need to set your expectations appropriately on a long list… 500 items x 5 seconds apart is 2500 seconds…41 mins something,

1 Like

List of things is wrong, obviously because it is red, but the reason it is wrong is that you are trying to set what should be a “list of things” (whatever the things are) using a number…that is what the count operator does, it counts the number of items and returns a number.

You want “list of things” minus item “list of things:first item”

Awesome really good to know! I’ll leave it set at 5 seconds for reliability. Thanks for the heads up.

Sweet Jesus it’s working!

Here’s a bunch of yummy test items that will mean nothing to anyone but make me very happy.

Thank you so much.

Your event names have empty values, that is why there are some spaces that show multiple commas and no name between them…must be the name value on that data type that is stored as the event name

1 Like

:slight_smile: yep was just to test some things out, dummy data. The amazing bit was having it all function! I’ve even set up some triggers now which monitor when there are changes and then these workflows are triggered.

Couldn’t have done it without your help.

1 Like