Simple Booking overlap Logic using Glide tables

Hi,

Im new to glide so please bare with me. Im building a trailer rental app with the following requirements:

  • A trailer_id can be booked for a day or more days at a time
  • A trailer cannot be booked in the same start and end date slot - other customers might have booked it already for the same period
  • A trailer cannot be booked in any of the dates inbetween the already booked start & end
  • A trailer can be booked in advance
  • when a new booking is made, the user need to get a notification that these dates are already booked
  • or alternatively one can attempt to show possible dates to book to the user (not sure if this might be easier?)

thanks

What if a user was to specify their desired start and end dates, and then you presented a list of available trailers for those dates?

Hi Darren, thanks for getting back to me

That could work - could you please guide me on how to build the logic for this. i already have the following:

  1. New rental booking form: start date; end date ; trailer to book view
  2. ive implemented the caching option whereby the user’s start and end dates are recorded into the caching table (so that i could validate it but i have not managed to figure this out)

i would need to give the customer the option to open for example the next 30 days for booking in advance. alot of customers will arrive and book for the day so we will need to at any point know whether a trailer is available or not.

Okay, sure.

I’m not exactly sure what you mean by caching option, but it is important that you write the user’s start/end dates to user specific columns to start with.

I’ll assume that you have a Trailers table that lists all your Trailers, and a Bookings table that lists all your bookings.

In your Bookings table:

  • Create two Single Value columns, one for the users start date, and one for the users end date. These two columns should take the user supplied dates and apply them to all rows.
  • Next create an if-then-else column:
    – If Booking Start Date is after User End Date, then empty (leave blank)
    – If Booking End Date is before User Start Date, then empty
    – If User Start Date is after Booking End Date, then empty
    – If User End Date is before Booking Start Date, then empty
    – Else Trailer ID
  • The result of the if-then-else column will be that any existing booking that overlaps with the user supplied start and end dates will have the associated Trailer ID in that column.

Now in your Trailers table:

  • Create a Joined List column that targets the if-then-else column that was created in your Bookings table.

Now all you need to do is add an Inline List component to your booking screen, using your Trailers table as the source, and setting the filter to exclude those trailers where the Trailer ID is included in your Joined List column.

5 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.