[SOLVED] Data Types and Populating Dropdowns

Hello Bubble World,

I have an app that requires categories and sub-categories and am not sure how to go about implementing this all. I have searched the forum high and low but haven’t managed to find info I need.

I am looking to be able to pick a category from a dropdown, and then in another dropdown the co-ordinating list of sub-categories will populate based on the category picked.

Also I have a Type called Ad Details that I would like to relate to these categories and also be able to search the Ad Details by category/sub-category.

Not sure how to relate all this data?

I have a Data Type’s
Ad Details: which contains fields with details about an ad eg. Ad Title, Category, Sub-Category, Location etc.

Categories: which at this point contains the fields Category Name, and then a list field with Sub-Category Name

Is this the right way to go about this? Or would you make another data type for sub-category? I tried this but couldn’t figure out how to relate a specific Category Name with it’s list of sub-categories.

Here is an eg: of categories and sub-categories

-Bedroom Furniture
-Couches etc


This maybe should be two separate threads, but they kind of go hand in hand so thought I would try with one thread.

Let me know if this isn’t clear and I will try and explain better.

Thank you in advance,

Hey @eworkapps!

You’re very much on the right track! Have a data type for all three: Ad Details, Categories, and Sub-categories. This will give you the most flexibility. The fields that reference other data types will allow you access their fields. Example:


  • category name (type text)
  • list of Sub-categories (type Sub-categories)

Dropdown 1’s source is a search for categories with no constraints, so it will display all categories. Set the label to be the name field.

Dropdown 2’s source is a search for Sub-categories with the constraint that they are dropdown 1’s value’s list of Sub-categories, so those are the only ones you see.

English example:
Dropdown 1 shows a furniture and vehicles. User selects furniture. Dropdown 2 shows Bedroom, office, living as options.

Does this help?


Ok great. Thank you @romanmg

One thing I don’t quite understand is how the category knows which subcategories belong to it? How do you form that relationship? So that not all subcategories show up for every category?

Thanks again!


Oh right, so when you create a sub-category, you’ll need to add it to the list of sub-categories for a specific category. This happens in the workflow area.

If you haven’t already, you’ll need to create a manager for yourself. Super simple - have an input field for name of category and a dropdown list of all categories and a button. When the button is clicked, action 1 is “create a new sub-category” and save the name of the sub-category in that same action, action 2 is “make a change to a thing” (in this case, a category) and in that same action you want to add the sub-category you just created to the category’s sub-category list. You can actually pull up the sub-category as the “result of action 1”. This may be a little confusing in type… feel free to share a link to your app, and I can set it up for you so you can study it. I promise it will make a lot of sense once you have it set up.

Is there something wrong with my workflow? It adds it to the sub-category, but doesn’t seem to show up under the category area.

thank you for you help so far @romanmg

That looks right. Ok, by category area do you mean the 2nd dropdown that should display the sub-categories of the category selected in dropdown 1?

I was referring to my data type in my database. When I test it out I can see that the sub category was added to sub category type but it does not show up under category type… unless it does not if it’s a list?

It should be there. Try changing the view mode for that field, so that you can read the list items by the name field. An easier way to test is through your dropdowns that you’re creating to view these on the front-end anyway.

Ok I guess I am having trouble setting up the dropdowns.

Here is the category dropdown which I think I have right

And here is the subcategory dropdown which I am stuck on.

Sorry for the slowness in catching on!! lol

No worries at all! Data structure just needs practice. Ok, you’re so close. Category is right. Subcategory… change choices source to “search for category’s sub-categories” and set a constraint on the “search for categories” -> unique id = dropdown 1 value’s unique id. Now, we’re only looking at the sub-categories of dropdown 1’s category selection.

EDIT: Oh an alternative way just came to me - for choice source: “Dropdown 1’s value’s sub-categories” That should work too.

1 Like

I don’t seem to have the choices you mention.

Am I missing something or?

Missing a few things -

EDIT!!! First, for choices source - keep clicking after “search for categories” not in the new search window that pops up on the left, just within the same input so that it reads “search for categories’s FIRST ITEM’S sub-categories”.

Alternative for choices source: “Source = Dropdown value’s subcategories”

Second, in your search constraint window - You’re very close. Type is category, correct. Unique id = dropdown category’s value’s unique id (keep scrolling down to get to the unique id option)

Your dropdown (a dynamic list) is set to display a list of sub-categories (type = sub-category), which you’ve done. Now, you need to tell it where to find the list you want (source). Your source, then, needs to be a list of sub-categories. If you did just “search for sub-categories” then it would display all the sub-categories you’ve added to your database without any relation to a category. Instead, we want a specific category’s list of sub-categories. Thankfully, you set up your database for this - your category data type contains a list field that is type sub-category. So, we can set our source to be a category’s list. From here I gave you 2 routes to specifying WHICH category:

  1. Source = Dropdown value’s subcategories

  2. Source = Search for categories [unique id = dropdown value’s unique id]'s first item’s sub-categories

Route 1 is more direct because you have access to a specific category already from the dropdown 1. Route 2 achieves the same thing, you’re just calling it up a different way by searching your entire database - you search for categories, restrict it to have the same unique id as dropdown 1’s value’s id, and since a search returns a list of results (even if you know that list is 1 item), and you’re wanting to specify 1 category, you need to indicate you want the first item of that search… and lastly, you want the sub-category list of that item. Hence, the format of route 2.

I’m sorry I had forgotten about the first item thing. I hope I haven’t confused you further…

I believe in you!


You’re a great teacher well done!


Sorry for the long delay in replying… I was out of my office for a few days.

I really appreciate your detailed explanations @romanmg I have tried both ways and unfortunately i can’t seem to get it to work. Would you like to take a look at my website and see what I am missing?

link removed

It’s almost like the sub-categories are not linking properly to the categories… Not sure.

If you don’t have the time, not a problem.

Thank you,

Oh By the way sorry for the mess of the page. The area I’m using to try and figure this out is the blue box called Problem Area.


Hey not a problem. I’ll take a look. Is your app private though? I can’t seem to access.

Yes sorry I changed it to public

Ok fixed it up. I noticed 2 things…

The workflow for adding a sub-category had you adding the sub-category to the “parent group’s category” - your group was indeed set to be type category, but there was no source, so it didn’t actually know which category and couldn’t be added to any list. So I updated the source in that parent group to be the category dropdown’s value. ( I also numbered your 2 category dropdowns so that workflows don’t get mixed up :slight_smile: )

2nd thing that was probably not contributing, but just in case - I think there’s a Bubble-related bug going on right now with dropdown selections - it takes 2 clicks for the dropdown to actually take a user’s selection, so just be aware when you’re adding a sub-category, that the category you selected is actually there and didn’t revert back to no value.

1 Like

That’s awesome! Thank you so much for all your help @romanmg :smiley:

Much Appreciated. I would recommend you as a teacher to anyone!

Thanks again,



Aw, thanks!

1 Like