Help Using Categories and Subcategories

I am struggling with displaying a list of FAQs using categories and subcategories. I am using the demo video my @Mark on categories. I have 2 sheets; FAQ-Main and FAQ-Tree. I am able to set up the 5 top categories by adding a reference (FAQ) in the Main sheet linking it to the Tree sheet. Top categories display correctly in details view. I have subcategories under each category except one (Miscellaneous). I am not able to create and link the questions with the subcategories.

What I want to see is my main FAQ page to show the 5 top categories and when you click on one of them, it should list its subcategories and then each question with its answer. If there are no subcategories, I want the questions to be listed.

The app is at https://faq4class.glideapp.io
The link for the sheet: https://docs.google.com/spreadsheets/d/1oAb4AEFjpV1dXW_xEEwUQXHlcSbhyyBpb7eWUicepbE/edit#gid=1889463118

Any help on this is greatly appreciated.

1 Like

So correct me if I’m wrong, say I click on Course Materials. Would it be true that you only want to see one Textbook option and one LMS option, then when you click on one of those, it would open up to a list of all questions and answers for that subcategory? I think we need to restructure your Tree sheet to build all questions and answers for a subcategory into one cell and then use markdown, but I first wanted to make sure that is how you are expecting it to work.

Yes, @Jeff_Hager, that is what I am looking for. The number of subcategories in each category and the number of questions in each of those subcategories will not be the same. I do not expect the subcategories to expand to more levels, though (like, Cat 1 > Subcat 1.1, Subcat 1.2; Cat >2 Subcat 2.1; Cat 3 > Subcat 3.1, Subcat 3.2, Subcat 3.3; Cat 4 > No Subcat etc)

Thank you for stepping up as always, @Jeff_Hager!

Here is how I would set up your sheet.

2 Likes

:clap: @Jeff_Hager! That worked! That is a clever fix. I am going to redo my sheets following your solution. Will keep you posted.

Thanks a ton for spending your valuable Sunday morning to solve my problem. You are a shining :star2:!

1 Like

@Jeff_Hager Very cool function combination! I don’t remember ever using that TEXTJOIN() function.

I tried to incorporate it into an ARRAYFORMULA(), to add some value to this post, but totally failed, lol.

@George_B yeah I’ve struck out using an arrayformula with something like this as well. I’m starting to think that any function that has potential to return multiple rows (i.e. Query, Filter) is not permitted by Google sheets to be used in an arrayformula. Even if you try to outsmart it and use a join or concat to get all results in one row, it still will not work. As a programmer this is frustrating when the logic makes sense in my head, but the function limits me. Oh well. I figured in this case, the categories won’t change much, so it’s easy to place the formula on each line.

1 Like

It’s been a little while coming, but we just finished the documentation on subcategories and using it with the new relation columns in the data editor. We’ll try and do a video soon as well. Hopefully this helps future readers. https://docs.glideapps.com/all/guides/deep-dives/design/subcategories

2 Likes

Hi Jack, I tried following the documentation and the video and am sadly struggling with this. I got to one level of inline but not to the next level e.g. age and age appropriate activities but can’t display the list of activities. Is there an existing demo I can follow? I looked at Jeff Hager’s multilevel demo but the data is not easy to follow. Any ideas appreciated!

Where did you have a problem in my demo? Each related sheet needs to contain all of the value from all the parent rows it is related to. That is why I use template columns to join multiple columns together, then create relations based on those template columns. If it makes it easier, just focus on the first 2 or 3 levels to see how they are related to each other.

Thanks Jeff. I got the first two but couldn’t get the 3rd. Perhaps if the content could be written like Jack’s vegetable example?

I find the video skips through steps too quickly for me (as it combines 1:3, 2:3 and 3:3 relations). And the glide apps documentation is different from your formula approach (pre new relations).

Am I right that relation values must be unique? Eg, using the vegetable analogy, carrot is part of root vegetable and can’t also add the characteristic that it doesn’t flower?

The main difference between Jack’s example and mine is that he packs the entire hierarchy into one sheet, whereas I like to create a sheet for each level of the hierarchy. I do this for 2 reasons. One being that it visually much easier for me to follow the hierarchy when viewing each level as a separate sheet. The other reason is that each level can have it’s own design. Detail layouts in glide are tied to a sheet, so if you have every level in one sheet, then you are stuck with the same screen design. That may work for you, but it could bite you later if you choose to have a different design at each level. There is one advantage in Jack’s example in that you could have virtually unlimited levels, unlike my example, where the number of levels is limited by the number of sheets I set up.

To briefly summarize Jack’s example, level 1 to level to is set up very similar to my example. From there he has a relation that links the Category column to the Parent column, so whatever the value is in the Category, the relation will return the matching rows that have the same value in the Parent column. This becomes an infinite loop within the same sheet. So, the top level is Food Types. The relation returns all rows that have Food Types in the Parent column of the second sheet. Here you select Vegetable and it takes you to the vegetable details in the second sheet. The second sheet then has it’s own relation that you use to create an inline list. Vegetables contains Bulbs, so clicking on Bulbs in the inline list will take you to the Bulbs detail row. Since it’s the same sheet and layouts are tied to sheets, the same inline list is shown but now shows everything that’s related to Bulbs.

I went ahead and added Jack’s hierarchy into my app. Just look for Food Types in the Multi-Level Select. Then you can take a look at the data to see how it all relates and compare it to his documentation.

Hopefully this is clear to you.

I haven’t updated everything in the app, but the Multi-Level Select is updated to use the new relations and all the new glide columns.

Relations don’t have to be unique. All they do is look for a matching value in the sheet you are relating too. Anything that matches will be returned. You can take this a step further and create array columns to create relations to or from multiple column values. You can also get a little crazy and create relations, then use lookup column to get an array of values from multiple matching rows, then turn around and use the lookup for another column. That’s a little more advanced, so it’s best to first grasp how relations work.

Thank you so much Jeff, you’re a star. I’ll have a look at it now. And thanks Jack for resharing.

1 Like

Why haven’t I ever seen this demo before? :exploding_head:

1 Like

@Jeff_Hager, is it in this app? Can’t see the Food Types in the Multi-Level Select?

Did you scroll down to the bottom of the list within multi level select?

:wave:t2: It feels like I’m spinning in circles, in relation to subcategories and hierarchy: I’ve watched @JackVaughan videos about multiple categories, and read over-and-over the page about subcategories and hierarchies AND even dumbed-down my db data to see things more clearly… AND I think I’m dealing here with very straight forward scenario, but I still can’t get this behave properly:

Here is the link to the sheet

Bottom line: I want to achieve the same scenario of “loop” within a tap like shown in the “food items” as shown here

Here are screenshots from glideapps data – any thoughts? thank you!!