Set a collection item to a different object and refer items inside of it

Bubble refugee here, please be gentle. :wink:

How do I do this sort of nesting (join?)?

  • I’ve got a collection list of family.
    • inside each of those, I’ve got another collection list of family_members
      • I would like to then set the collection item to the corresponding profile by filtering the list of profiles by the parent’s family_member.id

I was hoping to stay at my level of ignorance and use the filters,

but it doesn’t look like I can use a filter inside another filter.


FYI: I figured out how to get each text, but I’m sure there’s a better way by setting the collection item to the profile object and then referencing various texts to this object.

Where’s your data coming in from? Can you share the data model you are feeding into the collection?

I believe it’s a known limitation by the weweb team, based on a previous post. How can I filter by date from a collection where the date is part of an addon from Xano - #3 by MichaelLovell

Not seeing the data structure but making some assumptions, switch to the javascript formula and try something along the lines of this…

// Access the global variable containing the data Family
const items = collections['your-collection-id...de439c6947c9']

// Filter the items based on the 'family_member.id' property
const filteredItems = items.filter(item => {
    return item.family_member.id === user_id;
  });

  // Return the filtered items
return filteredItems;

The data is coming from Supabase. I wish there was a simple way to visualize the database, here is the next best thing I can do – some screenshots.

family

family_member

user_idauth.user_id

profile

idauth.user_id


Thanks, @MichaelLovell .
I was hoping there was some more native way, but I’ll use either Javascript or learn Supabase’s GraphQL.

seems like you should be able to return your data in such a manner no?

How many data calls are you making to get your data into weweb that you need to filter? 1 or more than 1?

you could share your data model by printing it to the console using some js in a workflow :wink:

console.log([insert collection here])

Thanks for all the help, I feel like I just got a :medal_sports: achievement unlocked.

The query:

:mechanical_arm: nice work!