Hey - i’m brand new to glide and really enjoying it. I come from a traditional SQL / web background so some terminology and setup is different and i’m getting up to speed on.
I have 3 tables - Users, Companies, Events
Users can own multiple companies and multiple companies can attend an event.
I want users to be able to add their own companies to an event and show the user any other company that is at the same event. In my Events table I have an Event Split Text column that holds the Row ID of reach company at the event
On the UI I have two components 1) Choice component that filters to only show the logged in users companies (works well) and 2) Collection that shows all the Companies at the Event
User A of Company 1 makes their company selections using the Choice component - works
User B of Company 3 makes their company selection and the data in the Event Split Text column for that event replaces what User A saved
Can someone point me in the right direction - I feel like i probably don’t have the right relations setup but i’m looking for advice
Not quite sure what your question is, but if it’s the following statement then you should be writing the choice to a user specific column instead of a regular column. That way users won’t be overwriting each other.
Yes, you are right. I was letting people from different companies write to the same cell. I’ve reworked my data structure as you suggested and I now have an event details screen with a custom collection showing each row where the Event ID in EventCompanies matches the Event ID in Events (I manually added some test data into the tables). On the UI the custom collection has a table that shows all the Companies within each row at that event.
Success..!!
I’m now stuck on showing the user only the companies that they own so that they can select them to appear/check in to the event. Either adding a new row if there is no existing row in the EventCompanies table for the current user or updating their previous selection for the event.
I’m trying to create this flow. User searches for event - on the event screen they can see all companies at this event - they can add or remove the companies they own to the event.
Any help or pointers on this last step would be greatly appreciated.
When a user views an event, use a set column action to save that event’s rowID to their user profile so you know which event they’re looking at.
To let users add their companies to the event, set up a form that writes to the EventCompanies table.
Assuming each company is owned by one user, you’ll want a Query in the Companies table that checks the EventCompanies table. Filter so that Company ID matches this row > rowID, User ID matches the signed-in user, and Event ID matches the one saved in their profile.
This tells you if the user has already added their company to the event. In the Users table, create another query (call it “availableForCurrentEvent”) that looks for companies owned by the user that haven’t been added to the selected event yet.
If this query is empty, the user can still add companies to the event - so show them the form. If not, don’t show the form.
I don’t seem to have access to any set column action. At this point thinking about giving up. I thought many to many relationships would be easily handled in a modern platform. It’s a little frustrating (not at you I appreciate the advice).
The data structure you posted makes complete sense to me and is exactly how mine looks but glides interface doesn’t seem to allow the building of many to many relationships like this. I’m off to read the docs a bit more but it looks like this isn’t possible. I guess no code tools aren’t as advanced as i’d hoped.
I had thought about simplifying things a bit by having one user own one business and put the business details on the user profile but i’d still need a many to many relationship - one user can attend many events and one event can have many users, going round in circles
You would change the click action for the collection to a workflow that first does a Set Column action followed by a Show Detail Screen action.
If you want to experiment with a different approach, you could play around with data structures, which let you add and remove elements from data sets. Glide seemed to alude in the past that it wasn’t stable, so I don’t think a lot of people have played around with them, including me, but it may work in your case. Probably worth a shot. I think I recall that it’s a little weird to work with and you need to create an empty set before you can add elements.