Best Approach to Setting Up a Hierarchical List / Outline Numbering / Tree Structure in Glide

Hi everyone,

I’m developing an app to manage a large set of requirements, and I’m looking for advice on the best way to implement a Hierarchical List or Tree Structure. Each requirement has a parent (main section) and, optionally, a grandparent (subsection). While the ability to go multiple levels deep would be great, it’s not essential for this particular project.

Key Considerations:

  • Screen real estate: To keep the UI clean and uncluttered, I want to avoid using extra columns to visualize the main section and subsection for each item. Instead, I’d like to use a Hierarchical List for better organization and clarity. (Screenshots attached below for reference.)

Requirements:

  1. Each item should have a parent, and potentially a grandparent, as well as siblings and an index.
  2. When a new item is added, it must automatically:
  • Be assigned a parent (unless it’s a main section).
  • Receive the next available index within its parent section.
  1. When an item is removed, the indexes of the remaining items should automatically recalculate.
  2. Items should be re-assignable to a different parent, with indexes recalculating accordingly.
  3. Items should be reorderable (moved up or down) within their sibling list.

Attempts So Far:

  • Approach 1:
    This method meets all the requirements above but has significant performance issues. It’s slow to load and heavily reliant on calculated rows, making maintenance more complex.
  • Approach 2:
    This system is much faster but doesn’t support automatic recalculation of indexes when items are removed or reassigned to a new parent.

What I Need Help With: Before spending more time experimenting, I’d love to hear how you experts might tackle this challenge. Would a JavaScript column be a potential solution for this use case? Should I migrate to SQL? Or has anyone successfully implemented a similar setup in Glide that balances performance and functionality?

Any advice, best practices, or examples would be greatly appreciated. Thanks so much for your help!


Hola Tim,

I think your case points to “when to use a SQL or NoSQL database”. This article can help you a lot

Many times we want to create our APP using a SQL structure in Glide and it’s is fine (although Firebase, the core of Glide Tables, is a NoSQL database :upside_down_face:) but sometimes use JSON to gather and search data is a better idea and fastest solution.

It all depends on your needs.

Saludos y feliz navidad Tim!

Your case is complex, but you might want to look into this method for reordering.

However I’m not sure how it blends in with your automatically generated index.

Hi Gustavo,

Thanks for your feedback, greatly appreciated!
Perhaps indeed I could use a bit less columns&relations if I would work with JSON objects. But I would need to think about it, will keep you posted if I found a good solution!

Happy holidays!

Tim

Thanks ThinhDinh for pointing this out!

That’s the kind of nugget I was looking for.
I think it can simplify and speed-up a large part of my first solution.
I’ll keep you posted!

@Andrew_Davies great thinking!!!

Happy holidays!

Tim

I think 1-4 is fairly straight forward, and I can immediately think of a fairly elegant solution for that.
But item 5 increases the complexity quite a bit. There are a few different approaches to manual reordering, but combining any of them with the first 4 requirements will take quite some doing.

Hi Everyone,

@ThinhDinh @Andrew_Davies @gvalero @Darren_Murphy

Thanks for you support in this, I used the input of @Andrew_Davies and built on top of it.
I know have something that has the least complexity possible I think and that works well.

Here’s a quick movie about it, if you would want to build something similar and you need more info, or you have an even better way to do this let me know!

Nice and clever solution @Tim_Gestels

Watching your video, I’m accidentally seeing a way to create a Gantt chart setup (table, tasks) and/or reorder its tasks on the fly.

I can’t find a better way to complete a Gantt chart setup like your proposal.
Thanks @Andrew_Davies as well, your idea reminded me of some old software I used 15 or 20 years ago that used the same technique on its dBase IV tables when a new record was added or reordered.

Saludos!