Hello,
The subject is the most concise version of what I am trying to do but here are some more details in case there is an easier way to do this I am not thinking of.
I have an Events Object and a I have a Location Object. Each event is connected to a location. A location can have multiple events on 1 day but each requires it’s own registration so they are each their own event in the events object.
When users are browsing events to register. I would like them to be able to browse by date and then when they click for details they can see the location and all of the events available for registration on that date.
So I would like the users to see a list view of dates with the location but I would only like each date to appear once for that studio. Here are some image examples of how I would like the listings to appear for users.
I don’t want the location to appear 3 times if there are 3 events at that location on that date.
SO I created an Event Dates Object with a date field and a connection to the location (location to many event dates) and a connection to the event (many events to one date).
So my plan was to have when an Event is added or edited it inserts or updates that Event Dates object. So I would need to check first if that date is in the Event Dates object and if the location was the same as the location connected to the event being added. If it does exist, update that record with the event, if it does not, create a new record with the date, studio and event. The plan being I can use that to do the listings and use the connected records for the filtering.
So I just need assistance doing that check if that date + location combination already exists and then perform an update or insert depending.
Step by Step:
Administrator Adds or Updates event in Event Object and sets the date/time and connected Location Object
Check if Event Date exists in Event Dates Object
IF No
Insert new record into Event Date Object with date, connected location and connected event Finish
IF Yes
Check if Location matches connected Event’s location
IF No
Insert new record into Event Dates object with date, connected location and connected event Finish
IF Yes
Update Event Dates Record with new event Finish
I would appreciate any help or insight or any other way do to do what I am looking for. It is worth noting that each event has variables that need to be used in filters so just adding some sort of dates to the location for listing would not work since it also has to retrieve the info from those connected events.