Make the new event start after the last one of the same date

Hello! I created this test app (https://datetest.glideapp.io/) to ask you for help.
When I create an event I only insert the date without the time. By adding details to the event (sub-events), the overall duration of the event is calculated, as the sum of the durations of the sub events. As a result, the end time of the event is calculated as the sum of the start date and the duration.
So far, so good. What I can’t do is make sure that the start time of a new event matches the end time of the last event already on the calendar for the selected date.

For example, if I have already entered an event that starts on May 19th at 0.00 and ends at 1.30, I would like if I insert a new event it starts at 1.30 and ends according to its duration.

I have tried numerous solutions but have not been able to find the right way!

Any suggestions?
I hope it is understandable!

Thank you so much
Roberto

Here you go…

What I did:

  • Added a Rollup Column to your Events table to calculated the latest calculated event end time
  • Changed your Event View to use a Details Layout, then built a custom form for adding a new event
  • When a new event is created, the Event Start time is automatically set to the maximum calculated event end time
1 Like

Thanks Darren for the help. Unfortunately my goal is slightly different. I must be able to choose the date of a new event (only the day without indicating the time) and automatically the event will have to start after the last event present on that very date (if there are no events it will start at 0.00).
I tried with a self-relation on the “Star Date” column and with a rollup I can identify the end of the last event of the day. But in the end I can’t reach the goal. Perhaps because a recursion is created on the event end date.

Thanks again!

1 Like

Unfortunately this is difficult to do using the add button up there. I’d suggest you to add a field out into Add/Form button to check and filter what you want

I’ve updated the sample app to meet those requirements.
It needed quite a few extra columns, so I won’t try and explain here. Suggest you take a look and let me know if any questions.

1 Like

Thank you Darren, as soon as possible I’ll take a deep look to understend how you did it

Here’s a summary:

  • Created a User Specific Column to hold the selected start date
  • Split the calculated maximum end date into its year/month/day components using math columns, then stitched them back together using a template column
  • Did the same as above for the selected start date
  • Created a relation joining the two template columns
  • The Rollup to get the maximum end date then uses this relation (ensures you are getting the correct end date/time)

Then when the user submits, there is a multi-step action sequence with two branches:

  • If the relation is empty
    • Means it’s the first event for the selected date, so add a new row using the selected date as the start date (which defaults to midnight, as it’s a date-only picker)
  • If the relation is not empty:
    • Add a new row, but set the Start Date/time to the Maximum End Date/time
1 Like