Creating Multiple Things from the result of a search or table with one button press

Hello!

On my app, I have a DB called Events that users can book on to. When they click 'Book" this creates an entry in a DB called ‘Bookings’ that references the event and the user.

This is easy for single-day events, as you just create a new thing in the bookings DB with the current event page’s data. However, I have some events that run for multiple days and I want users to be able to make bookings for all dates simultaneously. (NB. Each day of the event needs to be a separate booking due to an unrelated feature - all events under a multi-day booking share a common family reference that I use to bind them together).

I can’t seem to get Bubble to make separate things in the bookings DB for each day using one click. The source for this information is either a search for current page’s event constrained to the events family reference OR I have a table on the page that shows all of the unique days of the event dynamically (using the family reference) that I could potentially use as a source of information.

Does anybody have a suggestion for how I can make this happen in one button press?

Hopefully my explanation is clear, but let me know if not!

Thanks in advance!
Callum

I don’t know how to actually do it, but you have to basically run a LOOP. There IS a way to do this, but fundamentally you have to save the difference between the Start Date and End Date.

Assume: 3 days.

Then you run the LOOP 3 times each time you ADD +1 to the Date.

So functionally you have

Loop 1 - Create New Thing – Date = TODAY
Loop 2 - Create New Thing – Date= TODAY+1
Loop 3 - Create New Thing – Date = TODAY +2

You would have to build the Date + # based on the number of times it has to loop.

Again I don’t know how to actually do it, but this is fundamentally what has to happen.

2 Likes

That’s great - Thanks, Tim. The method you shared led me to a really informative YouTube video tutorial that helped me achieve this. I followed this method and it worked perfectly.

Thanks for pointing me in the right direction!

1 Like