Forum Academy Marketplace Showcase Pricing Features

Duplicates during batch processing and order of operations


I am using a lot of backend API calls to create data and struggling a bit with how to

  1. Not get duplicates
  2. The order things are being added

It appears that Bubble is adding items to the database in batches that pass the condition when they actually shouldn’t.

For example, let’s say I am calling a sporting event API. I search for the “Lakers” and it returns all of the upcoming games for the Lakers. Within the results, the venue of each event is returned. I want to ensure that the venue is added to my “Venues” table before adding the game to my “Events” table because the “Events” table needs to have the “Venue ID”.

The initial API workflow calls a backend workflow that will
Step 1: Conditionally “Create a new Venue” when Venues ID count is 0
Step 2: “Create a new Game” while adding the Venue ID that was either existing or just created (not using Result of Step 1 because venues could already exist)

The issues I am facing are

  1. If a game is being played at the same venue, it is adding it two times and ignoring the condition. I believe it is because Bubble is adding them in batches and when it checks the venue isn’t created
  2. It seems to be executing step 2 before step 1 is complete because it will add the game without the newly created Venue ID