# Simple Booking overlap Logic using Glide tables

**URL:** <https://community.glideapps.com/t/simple-booking-overlap-logic-using-glide-tables/43321>\
**Category:** Ask for Help\
**Created:** [June 21, 2022, 1:11pm UTC](https://community.glideapps.com/t/simple-booking-overlap-logic-using-glide-tables/43321 "2022-06-21T13:11:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![IlseB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ilseb/32/44063_2.png) [@IlseB](https://community.glideapps.com/u/IlseB)\
**Post date:** [June 21, 2022, 1:11pm UTC](https://community.glideapps.com/t/simple-booking-overlap-logic-using-glide-tables/43321/1 "2022-06-21T13:11:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [June 21, 2022, 1:21pm UTC](https://community.glideapps.com/t/simple-booking-overlap-logic-using-glide-tables/43321/2 "2022-06-21T13:21:25Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![IlseB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ilseb/32/44063_2.png) [@IlseB](https://community.glideapps.com/u/IlseB)\
**Post date:** [June 21, 2022, 1:25pm UTC](https://community.glideapps.com/t/simple-booking-overlap-logic-using-glide-tables/43321/3 "2022-06-21T13:25:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [June 21, 2022, 1:52pm UTC](https://community.glideapps.com/t/simple-booking-overlap-logic-using-glide-tables/43321/4 "2022-06-21T13:52:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [June 23, 2022, 10:39am UTC](https://community.glideapps.com/t/simple-booking-overlap-logic-using-glide-tables/43321/5 "2022-06-23T10:39:27Z")

</div>

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