Dependent Dropdown Using Ref

I am looking around for an example tutorial or answered question specifically to the scenario below. Any help is appreciated.

There are a total of four tables:
1 - Category (PK, CategoryName) Example data:

[1, Category 1]
[2, Category 2]
[3, Category 3]

2 - SubCategory (PK, SubCategoryName) Example data:

[X, subcategory 1]
[Y, subcategory 2]
[Z, subcategory 3]

3 - MappingCategories (Category PK, SubCategory PK) Example data:

[1, X]
[1, Z]
[2, Y]
[3, Z]

4 - Final Table (ColumnA, ColumnBโ€ฆCategory PK, SubCategory PK) Example data:

[ Data1a, Data2aโ€ฆ1,Z]
[ Data1b, Data2bโ€ฆ2,Y]

How do I go about setting up a dependent dropdown with MappingCategories table? I want to select a category and will only display the appropriate sub categories. In addition, I want the CategoryName and SubCategoryName to be displayed instead of the primary keys.

The data needs to be modeled like this so that the CategoryName and SubCategoryName text could change at a later point. This way the primary keys are referenced (which will not change) and the Name is properly referenced - regardless of name change.

I appreciate any help.

0 2 346
  • UX
2 REPLIES 2

My initial impression you currently dont have any clue to show the relationship between each main category and sub category.
assuming single main category could have multiple sub category.

On the subcategory table, you should add filed of main category, then you can make dynamic dropdown, based on the selection of main category, which will pull the list only for the subcategory belonging to the selected main category.

Steve
Platinum 4
Platinum 4


Top Labels in this Space