Add multiple items to database from a Multiselect Dropdown / Repeating Group

Hey! I’m building an app that allows different users to create their profiles and add the skills they have from a list of different options. These skills might be for example:

  • Advertising
  • Social Media
  • Automation
  • Design
  • Copywriting

I have thought of two different ways of making the Design but I can’t figure out how to make the necessary Workflows to create the database objects from the user inputs.

Design options

  1. Using the Multiselect Dropdown plugin from Bubble. This plugin allows the user to select different options from a dropdown.

image

  1. Using a repeating group, displaying all the different options with checkboxes and letting the user check the ones that correspond to the options they want to select.

In both cases, the user has to click the Next button after the choice is made. My question is: How can I store the data in the database when this is done?

What I thought of doing

I have created a data type called Skill with two fields:

  1. Name (text)
  2. Has it (list of users)

image

Also, I added a Skills (list of Skill) field to User:

Then, I manually created 12 different skills which are the ones I want to display for the user to choose. (Advertising, Social Media, Automation, Design, Copywriting…)

When a user selects some skills, I want to add those skills to the field called Skills (list of skills) under User.

At the same time, I thought of adding that current user to the Has it list of users that corresponds to the skills. For example, if User 5 selects the skill ‘Copywriting’, User 5 is added to the Has it list of users from Copywriting.

However, I can’t seem to make it work. Since it’s a multiple dropwdown, I need to make changes to multiple things when the button Next is pressed and I don’t know how to do it. Also, I don’t know if this is a good approach, if there is an easier way to do it, etc.

Any type of help is much appreciated. Thanks a lot for reading!

There are 2 steps in your workflow:

  1. add skill to user
  2. add user to skill

We are talking about step 2. I believe you could do it in 2 ways.

Bulk

  1. Make a change to a list of things. Where that list of things is the list of skills.
  2. The action is to add the user to that list.

Recursive

  1. That workflow accepts a list of skills.
  2. it would add that user to that skill
  3. call the API again passing the same list of skills minus the first skill

I’m guessing that the recursive way will be more reliable when you have 50+ skills.


However, if I were your Bubble coach, I would challenge you NOT to do one of the steps:

  1. add skill to user
  2. add user to skill

I’ve gone down this path and it can get spaghettified very quickly. I would advise to pick the one that you believe will be used the most. Get rid of the other. You can easily create a search that allows you to do the reverse.

1 Like

Thanks a lot for your answer @rico.trevisan !

I have decided to go with a simpler approach, using custom states and adding a list of skills to the user but not the users to the skills.

I have a repeating group with all the skills and one checkbox each. Whenever a checkbox is checked, the corresponding skill is added to the custom state Selected Skills of the repeating group. Then, when the button Save is clicked, I make change to the current user and “set list” making its field Skills equal to the custom state.

So far it’s worked well :slight_smile:

2 Likes

Hi, a new in bubble. can you show how do that? i don’t understand

thanks