How to eliminate choices after they've been selected: Many-to-many relations

I have seen a few threads about this question. Just wondering if anyone has come up with a workaround.

Suppose I have a People sheet and a Teams sheet. And a person is joined to a team using a Memberships sheet (with a person_id column and a team_id column). How can I ensure that a person can only have one membership for a given team? Or, to say it another way, how can I ensure that every row in the memberships sheet is unique?

Or maybe there’s a way in the UI to show only Teams for which the current Person does not have a Membership? Like a “not” relation between People and Teams?

Any ideas or suggestions are greatly appreciated.

Hey @lkenyan

Take a look in this Glide’s video, guess can help you

https://www.youtube.com/watch?v=0QGbNsAPhLw

How are people being assigned to teams? Form button?

Yes. That’s what I’m currently doing. The form is creating a Membership row with a Person ID and a Team ID. But I can’t seem to find a way to show only Team choices for which the current Person does not have a Membership.

Can a person join more than one team? If not, is that what you’re trying to prevent?

Yes. A person can join multiple teams, but should only be joined to a given team once. So, trying to prevent joining a given person to a given team multiple times.

Last question: is a person signing themselves up for a team? If so, this might be achievable…if an admin is assigning the person to the team, then this will be much trickier.

Did it!..I’ll create a video shortly.

This will also solve this issue:

@Lucas_Pires @Jeff_Hager

Stay tuned!

4 Likes

In my case, an Admin is assigning people to teams.

:confused: Okay…I’ll test. I’ll show you what I have so far and it may spark inspiration.

How many admins are assigning users to teams?

In the current design, there is no limitation to how many users might be given the Admin role.

Ok…I might have a workaround…but it’s a bit more involved with my current method. Video is almost ready.

PART 1: USERS ASSIGNING THEMSELVES

Here’s the video on how a user can sign themselves up for unique teams:

7 Likes

PART 2: ADMINS ASSIGNING USERS

This one features an admin assigning users to teams without repeats:

@lkenyan @Lucas_Pires @Jeff_Hager

7 Likes

Neat! Perfect done @Robert_Petitto :clap:

1 Like

Clever! Thank you so much!

Question: can you describe some alternative ways of writing the “selected user” to the column in the Admin sheet? Asking because in my early experimentation with using Glide for a couple of apps, I’m encountering this pattern several times. Wondering about maybe additional/alternative UI pattens that would achieve the same end-result.

Can someone in Glide give this man, @Robert_Petitto, a job please? :thinking:

7 Likes

@Robert_Petitto - thanks for all these videos

I’m your #1 fan (I even watched the ipad return procedures video!)

Kevin in VA

1 Like

HAHA! That’s awesome. Ya…if I were to do this all over again, I’d probably want to separate my school account from my Glide account…bit late for that at the moment though…I’ll cross that bridge if it comes down to it.

If anything it gives people a “full picture” of my day-to-day lol

1 Like