Many-to-Many Relationships

I think the answer to both questions is making the App login style Public with Email. You would then introduce the Attendee page into the app and set it up to filter by logged in user. They could then see the events that they signed up for and delete them. You would have to add the email columns to both the Participant sheet and the Attendee page. This way you can create Tab views of the Participants where they only see their names. Then on the details they could only add their names to events and you would be able to let them delete their names from the Attendees sheet view but not others.

I finally got the hang of it now that I got over the hurdle of modeling many to many relationships. Many thanks!

George_B, love your example app for the many2many. I am totally fine with the modelling and have apps working totally fine with this but it is first now I am having to create an app where the user creates a record that belongs to a parent record. Is the form submit the only way to pass through the ID of the parent record to be stored on the subrecord?
Despite setting up the relations both ways I am struggling to get the sub record to store the parent record ID.

1 Like

@dkjorgi Yes, the form is the only way to do it. Remember you are creating a link between the two lists (sheets) and the result is stored in a third sheet (Attendees). So you have to be in a details view of one of those two sheets in order to know which single record (row) to link the one side to. Then you use the choose component to select which record (row) of the other sheet to link it to.

It would certainly be nice if there was a Search component, as a Choose component gets unwieldy quickly when the list of records is large from which to choose.

1 Like

@Mark and @david BTW I originally was going to use the unique ID feature to make the link relationship on the Attendees spreadsheet but realized that it wouldn’t work for this many to many style of relationship because of the choice component. When adding an attendee to an event either from the participate detail side or the event details side of it, both need to use a choice component to select the other side of the relationship, and since the choice component only allows you to select on column, using the Unique ID column would be useless.

See my post about an enhancement to the choice component:

2 Likes

That was the key, thank you for that. All working fine now.

@George_B Thanks for the m2m app, it’s been really helpful to play with!

One of the drawbacks with it is that it’s not the best UX.

Current process

  1. Add event
  2. Navigate to participant
  3. Add participant
  4. Associate participant to event via attendees

In above, ideally, steps 2 - 4 can be eliminated if user can add or associate new participant to event in event details page.

Then when looking in Relation List, see all participants.

I’ve been trying to figure it out, but have been unable to

In my app, I’m not using the m2m which is causing duplicate participant records. So either way, there are drawbacks

It was just a simple app to demonstrate a somewhat more than basic concept.

1 Like

If you are willing to have events and participates all listed on one sheet then you could have a text entry and a choice component pointing to the same column and a user can select an existing event the same could be done for participants. All on one page. Your choice components would then need to built off of a unique list of events and a unique list of participants in a separate sheet.

That’s a really good idea. Going to try that out. Thank you!

1 Like

Not sure if it is what you were looking for, but you could do this if you filter the available choices using the signed-in user email.

2 Likes

@Alfonso_Aguilar I think you are missing the Email Special Value when adding participants. It’s not saving with an email.

Sure! My fault. Should be fixed now. Thanks @Jeff_Hager!

1 Like

Hi @George_B :wave:

We seem to be facing a similar issue with the Many-to-Many relation feature, but unfortunately can’t seem to access your example app anymore:
https://many2many.glideapp.io

Here is a quick explanation of our issue:

The use case
We need to recommend specific selections of services to specific users, meaning:

  • 1 user = Many services
  • 1 service = Many users

The database
We have :

  • 1 spreadsheet with 1 row = 1 user = many services :white_check_mark:
  • 1 spreadsheet with 1 row = 1 service = many users :x: >> but no user will show up in the users relation column. Which means that we can’t filter the services that we will show to users.

Here is a short video explaining the issue:

We’ve been trying to figure this out, but nothing will do the trick and I feel like we might be missing something. Does someone know how to make this work?

Cheers :pray:

The first thing I notice is that you are comparing two unrelated columns. You are comparing a name to a user email. Those values will never match each other. A relation needs a common value that matches down to the letter.

Can you also show how your relation is set up in the Tes Service sheet? From what I’m understanding, you want the opposite of that relation in the Detail Services sheet?

It seems that that app somehow got unpublished. I republished it and made it copyable so you can take a look at it. https://many2many.glideapp.io/

Awesome thank you @George_B :pray:

@Jeff_Hager thank you for your reply, here is a video answering your questions:

Ok. It gets confusing sometimes because glide uses the same column icon for both relation columns and array columns. Your joined service columns in Tes Service is what we call an array column, because it’s an array of multiple values.

What you should be doing is changing your relation in the Detail Service sheet to link the Nom to the Service column in Tes Service. Again, you are trying to match a service name to an email address, which will never match because Service Name does not equal email address.

If your goal is to get an array of email addresses into the Detail Service sheet, then you just need to fix your relation to link name to service. This will link the row in the Details sheets to multiple ROWS in the Tes sheet. The you will add a Lookup column to pull the array of email addresses out of the the relation.

3 Likes

Thank you so much for your help!

We were able to make it work!

In our case, creating a separate “Attendees” (or in our case “Services-Users”) sheet, wasn’t possible as we don’t have a button that will trigger the creation of each row.
What did the trick was to add 2 columns in our “Detail services” sheet:

  • Email ID - Service relation
  • Lookup email id

Here is a quick explanation, just in case it might be useful for others :slight_smile: :

3 Likes