How do i have more than ONE category

Hi everyone, I’m building a directory app where each listing currently belongs to a single category. However, I’ve run into situations where a single listing needs to be associated with multiple categories. For example:

  • Listing 1 → January

  • Listing 2 → February

  • Listing 3 → January and February

What would be the best way to structure this in the database? Should I create a relationship (like a many-to-many relationship) between listings and categories, or is there another approach I should use to allow one listing to reference multiple categories?

Thanks

1 Like

In your Listings table you can have a column that contains a comma separated list of Categories. Use a Split Text column to create an array from that, and use the Split Text column in a relation.

You just need to be careful that your category names don’t contain commas. If they do, the above will break down. A workaround to that would be to use CategoryIDs (RowIDs) instead of Category names.

Another way is to create an array directly by using a Multiple Texts column.

2 Likes

Thanks for the reply. Will this work even if i have a large database already? or is the solution best if im starting from scratch? Thanks

1 Like

It doesn’t really matter either way. How large are we talking? (total number of rows)

1 Like

Slip text Array worked like a charm! just connected it to my category column and seperated the categories with a comma and voilà! Thanks so much.

2 Likes