I have searched and cannot find my specific situation. Apologies if this has been answered elsewhere. Please feel free to direct me to any existing responses.
I have a database that includes the Locations of schools. One of the fields is the ZIP Code of the school. Another field in the database is a list of employees of that location.
Here’s what I am trying to do - allow users to search for locations by ZIP, make a selection, and then have them added as an employee of that location in the database. Ideally, I’d like to set this so it displays and I’ll give users an option to update/edit their selection as needed.
I have created a way for users to search by ZIP code. The search populates a Repeating Group of locations that are within that ZIP Code. This works exactly as I’d like:
In my example, I searched for ZIP Code 30096 and the repeating group populates with the right results. Now, for example, I want the user to select one location (ex: Duluth High School). The icon will change to show this has been selected. But the database would update the list of employees field for that location to include this current user.
I am still new to Bubble, but making good progress. I cannot do this via Option Sets (unless someone corrects me) because the list of locations is thousands and thousands of records. I need to pull the data from the fields in the database. I cannot manually add them all into an Option Set (correct?).
I’ve tried different Custom States and Workflows and Conditionals, and am sure I am just making an error in my setup. Happy to share any additional screen shots as needed, and appreciate any guidance in advance.
also … I did create a separate Repeating Group that allows users to select from a static list of choices. Because this is a set list, I did this via Option Set and it works exactly as I’d like:
Create a State on the Repeating Group of “selected school”.
When you click a row, use the “set state action” and set the “selected school” state to the row that you just clicked. Eg it might be “Parent Groups School” or “Current Cells School”.
Then create a “condition” on your checkbox so that when “Current cells school” = Repeating Groups “Selected school”, it’s checked/blue colour.
Then you can do whatever you want in subsequent steps… eg if you want to save that school to a List somewhere on the user, after you click “update”, create an action that adds the Repeating Groups “selected school” to it.
You could also achieve multi select the same way. Change your state on the RG to a list… then when you click another row append it to the list.
The workflow (should) add the current user and then display a success message. It does the success message, but the current user is not being saved into the location’s list of employees. Any ideas?
Ensure that the group that this workflow is attached to is the immediate group inside the repeating group.
Can you snap that workflow itself, so we can see the element that triggers the click workflow. @mike1mus
Hi @mike1mus how is button save location able to access parent location? I guess this is why it is not working. I think you should be accessing the selected school or selected school location (that you eariler saved in a state), so you can save the current user on it.
I think you are right, but I am not sure how to update this correctly. I appreciate any advice. Again, I am sure this is an error on my part somewhere.
This all works so I can select one checkbox, and it changes the icon as a result. But, it does not allow me to create a workflow that points to the value(s) in a specific cell of the Repeating Group. I only ever see Current Cell’s index as an option.
OK, so I figured this out. I changed from a Repeating Group to a Table.
This allowed me to make the changes, and for the user’s choice to save to the database in the right way. I am sure there is a way to do this with Repeating Groups, but shifting to a Table worked for me.
Now, I will style the Table to look more like a Repeating Group. I like the way the Repeating Group looks for my app better, but I can live with the Table since I can get that to work lol.
Truly appreciate the advice and suggestions provided. One day, I hope to understand Bubble enough to contribute in the same way you all did.
That’s great @mike1mus even though the repeating group can still achieve what do want. But yeah, it’s fine, it all part of the learning process. I’m happy you figured a way out.