Car Rental App: Search For Available Cars Within Given Date & Time Range

I’m building an app in Glide for a car rental company.

How I would like it to function:

  1. User first inputs desired pick-up and drop-off date & time for when they need a car, then clicks search button.

  2. A list appears of available cars within the date and time range inputed. Cars that aren’t available shouldn’t appear at all! (Turo.com is an example of how I need it to function).

How my database is structured:

  1. ‘Vehicles’ table housing all the vehicles the rental company has in it’s fleet.

  2. ‘Bookings’ table housing all rental bookings with pick-up and drop-off date and time, with an assigned vehicle to the booking relating to the ‘Vehicles’ table.

  3. ‘Search’ table with one row for the search function that has user-specific columns 1) pick-up date & time 2) drop-off date and time.

Issue I’m having:

I can’t figure out how to tell the filter on the results screen to only show available cars within the date and time range inputed.

I went through all the threads in the Glide community that could possibly help me, but I haven’t found anything that matches the exact UX that I’m trying to achieve, where the user first searches, then sees a list of available options. Most booking apps do it reverse, where user first sees all options, then clicks option, then inputs dates, then has to ‘check if available on those dates’. This method won’t work for what we are trying to achieve in terms of UX.

Can anyone please help me figure this out?

Much appreciated :pray:

You could do something like this:

  • In your Bookings table, create two Single Value columns, one to take each of the DateTime values from your Search table.
  • Next create an if-then-else column as follows:
    – If Single Value PickUp Time is after Booked DropOff Time, then null (leave empty)
    – If Single Value DropOff Time is before Booked PickUp Time, then null
    – Else true
  • The above column should return true (checked) for any bookings that overlap with the selected date range
  • Now in your Vehicles table, create a Query column that targets your Bookings table and uses the following filter conditions:
    – Vehicle is This Row → Vehicle, AND
    – if-then-else column is checked
  • You should then be able to use the state of that query column as a filter for your Vehicle list (only show Vehicles where the query is empty)
2 Likes

Actually I missed the above in the solution I offered. To get the above you could extend my suggestion with either of the two following options:

  1. Add a visibility condition to your Vehicle list such that it’s only visible when both user specific columns are not empty, or
  2. Add some additional checks to the if-then-else column such that it returns true if either of the single value columns are empty (these would need to be the first two cases)

Hi Airon, this template that I created does exactly the UX you’re looking for. Glide Templates | Company vehicle reservations | Create a No Code App

It actually does either UX… As you requested, the user can enter date and time for pickup and return, and then see a list of available cars, and then reserve. Or for use cases where user may want a specific and limited item… say they need a moving truck of which there are few and they’re flexible on when they need it… they can select from all vehicles and see when a particular vehicle is available.

The data is structured similar to what you described. It has a vehicles and bookings/reservations tables, as well as a single row table… “Check Availability” which like you said, has user specific columns for inputing search criteria, and also in that row it relates to a list of vehicles that meet the availability requirement, which is then displayed to the user.

I created the logic using javascript, as I had used a similar solution in another app that required both setting availability (rather than here, a vehicle being available anytime not already in use) and taking appointments/reservations of given lengths… basically calendly I suppose. I needed JS as far as I could tell, to give the user great flexibility in setting their availability. In this car rental app where that component isn’t needed, perhaps Darren’s solution is easier to set up being that you don’t need any JS.

2 Likes

@Darren_Murphy I can’t thank you enough for providing this solution! Worked like a charm.

I was sitting on this problem for the last couple days, and almost gave up on Glide, was already doing research into other no-code tools and decided to give it a shot on Glide community.

:pray: :pray: :pray: :pray: :pray:

1 Like

@MatthewS Thank you for providing this resource.

Thankfully, Darren’s method worked perfectly for my use case.

I’m very happy to see that it worked for you.

The Glide Data Editor is quite powerful, but there is a bit of a learning curve. Fortunately there are plenty of folks here in the Community only too willing to help and share their experience.

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