Categories, Arrays, Relations - Help

Hi

Building a directory app for local non profit. We have businesses, as “items”. Each item is in a category, eg Accomodation.

We would like the same item to appear in other categories as well, eg Tourism. After reading the forum I made an array column, joining the 3 categories from my Google Sheet, and in the Glide Data. I have also created a category relation column.( which I’m believing to be unnecessary for now ?)

What I am struggling with is in the collections, or how to display the items. At the moment, I can only seem to group them by 1 category?

Ideally I would like to have a collection, displaying all items, but grouped into all the categories, and then the categories sorted by A-Z.

App is here, https://love-notties-am3r.glide.page

An item can only appear in a single list as many times as it appears as a row in the table. If an item is only in one row, then you will only see it once in the list regardless of how many categories it belongs to.

To make it work the way you want, you would have to forget about grouping and instead add separate collections. One for each category to the screen.

Another alternative is to have a separate table with just categories. Present the list of categories to the user, and when they select a category, then show the items that belong to that category.

2 Likes

Morning Jeff,

Thanks so much for your reply.

“Another alternative is to have a separate table with just categories. Present the list of categories to the user, and when they select a category, then show the items that belong to that category.”

I’d like to explore this

I have a table of categories, and had a count function to show the. number of items in each category, but I battled with the part to " show the items that belong to that category"

So how do I show the items in the category?

In your Items table, add a Category column and populate that with the name of the Category that each Item belongs to.

Then in your Categories table, create a multiple relation column that matches the Category name with the Category name in your Items table.

In the Layout editor, add a Collection component and set the source to be your Categories table. This should show you a list of Categories. Clicking on any one will take you to the details screen for that Category. On that screen, add another Collection component and set the source of this one to be the multiple relation column. This will give you a list of Items that belong to the Category being viewed.

To get a count of Items per Category, add a Rollup column to your Categories table and point it at the same multiple relation column, taking a count.

2 Likes