Listing items in nested categories

Hi there! I am new to Glide and having some (many…!? :wink: issues. I want to create a simple inventory app, where you can have a list of items that you can view based on a few attributes (eg category, date, location, sub-location, status, etc.).
Problem: My locations are nested (eg level 1: building, level 2: floor, level 3: room), and given many buildings will have level 2 for e.g., just using the level is not unique. Here are the tables I have with their columns to try to manage this:

  1. ITEMS TABLE: Row ID, Item name, quantity, building, level, room, exact level (make array column pulling building + level fields automatically), and exact room (another make array column pulling building + level + room fields)
  2. BUILDING TABLE: Row ID, Building, items in building (relations column to show all items in this building)
  3. LEVEL TABLE: Row ID, Building, Level, exact level (make array pulling building + level), and items in exact level (relations column pulling from exact level in this table to exact level in ITEMS table ***That does not work!
  4. ROOM TABLE: Row ID, Building, Level, room, exact room (make array pulling building + level + room), and items in exact room (relations column pulling from exact room in this table to exact room in ITEMS table ***That does not work!

Few questions:
A) is this the right way to structure the data?
B) On my levels table, how can I get the items in a given level within a building to show up? Eg all the items in building A on level 2, when buildings B and C also have level 2.
C) I read that using RowID is more robust. How do I use it on my ITEMS table? For e.g., when selecting a location for a given item, should I use the RowID instead of typing in the info?

Thank you!

Make Array is the wrong approach. Arrays are collections of multiple individual items instead of one cohesive value. For what you are attempting to do, a template would serve you better…but…I would consider using a Query instead of a Make Array and Relation because a Query can create matches based on multiple values instead of just one value.

Storing RowID in each of the child tables is more robust because it allows you to change a building name for example without having to update every row in every other child table that refers to that name. It all depends on how you add child rows, but I would consider it. You can still use relation/lookups or query/single value combinations in the child table to the parent table to retrieve the actual names.

2 Likes