That could work - could you please guide me on how to build the logic for this. i already have the following:
New rental booking form: start date; end date ; trailer to book view
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.
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.