User (does not currently have a field for Groups the User is a member of)
Group (has a field for Users who are members of the Group)
I want to display a repeating group on the Group page which shows the list of users for that Group
I get completely lost when I set the data source…
Should the type of content be User? or Group?
When I set as Group, I can see the User(member) field, but can’t work out to get it to display that in the repeating group?
When I set as User, because there is currently no Group field in the User data type, I can’t seem to look it up. I realise I could add this field to the User data type, but I am a bit concerned about adding a new field just because I can’t work something out!?
When I’ve done tutorials, setting the repeating group seems so straightforward, but when I am coming to it myself as a beginner, I really get lost. I feel like I don’t understand the interplay between the Data Source field, and the Search for X field (see screenshot) - any clarity here would be appreciated!
Should I instead set the type of content to “User” ?
Then use the term Search for Groups:first item’s Users?
If it’s not too much trouble, could you also explain why “first item” is the way to go? Is this a bit like setting the start of a loop? By telling it to look at the first item, it will then iterate from that item until the last item in the list? When I read “first item” my first thought is “first item only” - sorry the logic is escaping me here.
Hi there, @samosa… you are certainly in good hands with @robhblake, but maybe I can jump in here, too.
Because you are ultimately displaying users in the repeating group, I believe the Type of content for the repeating group will need to be Users. That being said, the “bigger” question is how do you know which group’s users to display. If the page is “aware of” the group, then the data source for the repeating group will simply be Current page Group's users. If the page is not “aware of” the group, then you will need to search for a group in order to display its users, and that’s where :first item comes in.
For example, let’s say you have a dropdown on the page labeled dropdown | group, and a user has to select a group from the dropdown in order to see its users in the repeating group. With that configuration, your data source for the repeating group would be the users associated with the first item in a search for groups where the group is the one selected in the dropdown. So, in Bubble terms, Search for Groups:first item's users with a constraint on the search of something like group = dropdown | group's value.
Anyway, I hope any/all of that made sense, and I hope it helps you get down a good path.
Thanks for your explanation. This was very helpful and got the cogs turning!
As you intimate I think there is an issue with making the page aware of the group. I think I am going to have to find some tutorials on sending data between pop ups / pages / repeating groups, because I am breaking everything!
Based on what you said though, just to make sure the logic is right… currently I have a pop up dialogue which lets a user insert a unique code, if that code matches an existing group they can join it, or they can create a new group - once they have done this the idea is that it will display that group. In order to do this I guess I need to pipe the group info from the pop up input to the actual page so that the relevant group’s data is displayed? Once the relevant group is identified then as you say I can set the repeating group data source to be Current page Group’s users?
Regarding the idea of “first item”… so is it really just about telling bubble to use the first result of a search for something? Usually the constraint will be so tight that there is only one item in the result anyway, but you still need to tell it to take the first item?
Thanks again for this, I feel like a real dope asking these questions!
Pretty much yes and yes to your second and third paragraphs, @samosa… and don’t feel bad at all for asking these questions. Bubble themselves admit the learning curve is steep, but once things start to click (and they will), it’s amazing what you can do with this platform.