Custom state with sub-categories

Hi,

I’m trying to create a form which looks like this

  • Skill 1
    • Subskill 1.1
    • Subskill 2.1
  • Skill 2
    • Subskill 1.2
    • Subskill 1.2
      etc

The user can choose maximum 3 skills and as many subskills as whiches.

The problem I’m having is transporting these choices to the database in a structured way. I’m trying to use custom states and save as text, but it’s not possible to define a relationship between a Skill and Subskill.

Any ideas how I can solve this?

What you’re describing is what Bubble calls a Thing (a custom data type that is an object).

You should define a data type “Skill” that has a scalar field “Name” (a text) and a field “Subskills” (a list of type “Skill”).

It sounds like you might also want to work through the Bubble Lessons before continuing.

I understand all of this. But when using custom states to “collect” the choices from the user I can’t figure out how to do it in a way that I can sort the subskills under a skill in the database. If a user can choose between skills (Skill 1, Skill 2 etc) it’s easy to just save them in a custom state and send them to the database. But when someone can choose Skill 1 + Subskill 1.1, 1.2 etc it becomes more complicated because it’s not possible to relate subskill 1.1 to skill 1 in some way. It all just becomes a long list of texts.

For example, this is the way a custom state “array” would look like in text:

Skill 1, Subskill 1.1, Skill 3, Subskill 3.1, Subskill 3.2”

If these are all saved in the custom state as text it is not possible to sort sort them out later, i.e. which subskill is related to which skill.

Things are not strings. And custom states can hold Things just fine.

I don’t see why you’d want to fight “the Bubble way” of doing things in this instance. When the user creates a new Skill, we’ll, just create the new Skill. Then create and attach subskills to the Skill’s subskill list as they are created.

1 Like