Help with team and members/Data

Hello, I would like to create in my application the possibility for the user to create more than one team with the possibility of more than one member in that team. It turns out that I am not able to create the user’s view of the teams they are part of in the repeater group, I can only make it show all the teams that exist in my application. I am also unable to create a tab to show the users of that team that it is currently “active”. Could someone give me some help? I’ve looked everywhere and haven’t found much about it. Thanks to everyone who helps

There are many ways to do this… it depends on how you structure your database.

You might have a list of teams on your user, in that you can just use current user’s list of teams.
You might only have a list of users field on the Team datatype in which case you would have to do a search for Teams with constraint: List of Users contains current user.
If you want to save more information about the relationship between users and teams (role, files, contributions , etc.) you might have a whole new table called team member which would have a field for user and a field for Team. (This is called a junction table) In this case just do a search for Team Memebrs with constraint User = current user…

And the list goes on…

If you want to research more about this (theres a lot out there), the technical term is ‘many-to-many relationship’.

1 Like

Hello, today I have the following tables in my database. User: Stores user information Team: Holds the teams and has a field with the list of TeamMembers TeamMembers : Contains role information and has reference to the User table. I need to make a filter to get all the teams that the user is currently in, I tried a few ways but it didn’t work.

Sadly with your current arrangement its not actually possible to get a user’s teams. Bubble is lacking of a “join” operator that would allow you to bridge the gap between users and teams.
You are going to have to add a field on one of your datatypes to connect the two. I would recommend to add a Team reference field on the team member dataType. Its going go be a useful field in general, and its standard practice to have this reference field on this type of dataType.
Once added, it should be easy for you to get a user’s team.

1 Like

How can I do this? If I add a field to the Teammebers data with the “field types” of “Team” as a list, will it resolve the issue?

It probably should be a single item rather than a list.
Doesn’t the team member dataType just store information about a user’s relation with a single Team?
If you add a single Team on the Team Member dataType, you’ll be able to retrieve the user’s teams by running a search for TeamMembers (Constraint: User = Current user) and then referencing :each item’s Team.

I don’t know if I did it right, but I put an item called listteam in the user’s DataType, to list all the teams that the user is part of.

In the team’s DataType, I placed an item called memberslist to list all the members who are part of that team.

In the DataType of teammembers, I placed an item called team, to list the uniqueid that was generated for the user to join another team (each time the user joins a different team, a different uniqueid will be generated for the user for that team.

I don’t know if it was easy to understand, but it seems that to list the members of the user’s active team, it worked. Now I wanted to make a repeating group, showing all the teams that user is part of, do you have any ideas?

Thank you for the help you provided me, I wish you all the success in the world

For some reason, he is returning the teams, but in sequence.

I would like them to stay like this



and each team like this, I would use it as if it were a button to choose which user will use at the moment