Hi I’m hoping someone can help?
I am trying to create an app that creates an event and within the event it can create multiple people within that new event. But i cant work out how to add a number of people to the event. Below is a description and screen shots of what id like to achieve:
So i click on add new event and get the below page
Once they have filled out the fields they can click add new person and it will add a person to the event without coming away from this screen. (The Event data hasn’t been created because they may come out of this page and i dont want it to create an event until the button on the bottom is pressed.)
is it possible to create multiple people on this page and then it creates the overall event by pressing the button on the bottom of the page?
Below is my data types i have made:
I hope i have explained this ok and i appreciate any help
I have decided to take this as a personal challenge. Please let me know if there are other ways, experienced bubblers.
I guess what @seanc07 suggested can’t be easily done in Bubble because there is no bulk create method for the people you are supposed to create in the UI (without creating them in the DB). However, you can mimic a bulk create by using two custom workflows.
First, about your design: probably you want your
People data type’s name to be
Event will have
a list of Persons called
People (instead of just one Person).
Now see the demo below:
You can’t assign a list of persons as custom state and add the temporary persons to this custom state. So, I had to store them a custom state of text list combined with comma in my case (but it can be combined with any character. I see you have address too, maybe combine with something more unique). Later, you will split them by the same character.
This is what add person button does:
The custom state is on the button as you see. See what I add to this list: the combination of the text fields of a person with commas in between.
Save Event Button
Then, the save button does this:
Create a new event (nothing new):
Reset inputs (nothing new).
Save this event to the page as a custom state (this is not required, just to show them below in the demo):
Schedule a custom workflow (that does the creation of people one by one). I scheduled for 1 second but it can be shorter. I have tested 0.1 second and it works like a charm too:
First Custom Workflow: Create People
Now, let’s see this custom workflow:
Create a person in DB. Now, this is the part where you will get the first item in the personlist custom state and split them by comma (or whatever you set) and put to the correct fields of a person.
Add this person to the page’s DB event (you can get the created event in other ways like
do a search for as well if you want):
Remove the processed text of name-lastname (in step1 of this workflow) from the personlist custom state:
Trigger another custom workflow (Next Call) that calls this one recursively. Bubble doesn’t let you to call this workflow in itself. So, you have to schedule the workflow with some delay. And this call will only happen if there is more persons in the personlist custom state.
Second Custom Workflow: Next Call
This workflow will just call the first one, that’s it (and again, 1 second can be shorter if you want):
I know this sounds a lot but hey, it works
Here is the demo page if you want to investigate the details:
@hergin thank you so much for such a detailed explanation I will try and build this through today and let you know how I get on. I really appreciate your help