How nesting list of list work

been using bubble.is for 1 month but still need understanding how nesting/chunking/parents grouping works.

Like a groups/list with in groups/list real life:

User 1

House 1
Group of items 1
item in the group
Group of items 2
item in the group
House 2
Group of items 1
item in the group

Like how is the best way to work with apps with a bunch of grouped content within groups, etc.??

Any insight would be appreciated.

You could go about it this way - though I made this three levels of nesting instead of the four you put in your example:

  1. Create your data structure:

Thing called User (automatically generated)
Thing called House
Thing called ThingsForHouses

  1. Link your houses to user (I would do vice versa, but that’s a performance/preference thing. Easier to link house to user). Create a field under “User” called usersHouse and make it type House. Make sure that you check “this field is a list (multiple entries)” so that we can give our users many houses.

  1. Same, link “ThingsForHouses” to “House” by creating a new field with type “ThingsForHouses”
    4

Again make sure you check many entries.
Now you have a simple nested data architecture. Somehow input some houses to some users, and put some things in each house. I’m assuming you know how.


Displaying data:

You can easily nest Repeating Groups (RG): look at this structure.


The parent RG loads your users. I just did “do a search for users” with no constraints.

The first child (background #fff) loads type “House” and gets them by doing Current cell’s User’s usersHouses which are all the houses associated to that user

The next child (background blue) loads all the things associated to the house in the current cell, same way:

That’s nesting in a nutshell. Now you asked for the “best way”. I don’t know that I know the best way, but once you get comfortable with nesting and linking data this way, I might suggest linking a user to houses instead of houses to a user. Reason being that your app will likely call up User in many scenarios and Bubble loads all associated data to that user. Separating the houses from the user and then calling a search (do a search for houses > constraint user = current user) when you need the houses may be faster on large apps. Although if you’re just getting started, this method will be just as fast and it won’t be overly difficult to change it later.

Hope that helps…

4 Likes

this is epic so helpful thank you!!!

This topic was automatically closed after 70 days. New replies are no longer allowed.