Filtering a list based on date range comparisons?

So I’m trying to do the following, and maybe I’m going about it the wrong way so please lend me your thoughts on this.

I want to create a booking page. Dispatchers will create a booking and assign a Pilot and an Aircraft to the booking.

When they create the booking, they set a start time and an end time from date pickers, which save individually in the booking in the background, but also saves to a “Date Range” for the booking as well in the background.

For each Pilot and Aircraft, when a booking gets created, the Date Range from the booking also gets saved to a List of Date Ranges for the Pilot and Aircraft.

When dispatchers create a booking, I want a repeating group of Pilots to be filtered by if they are available for that time or not…but I’m having a hell of a hard time trying to figure out how to do this.

Where I’m running into an issue is with the Repeating Group. Bubble will not allow me to use the list of Date Ranges as a way of filtering. Why? I have it set up as a Bookings column which contains a list of date ranges assigned to them based on whatever Bookings they are attached to.

Basically what I am trying to do is compare the date ranges assigned to the Pilots to the date range selected by the Dispatcher when creating a booking, then only showing Pilots who do not have a conflict.

You may need to use a list of dates rather than a “range” for this – essentially, set up an “unavailable dates” field on your Pilots that is a List of Dates, and gets updated with every date from the selected range. That way, you can then check individual dates to see if they are or are not in this list.

Thank you for the suggestion, but I don’t think that’s going to work.

Pilots are unavailable for the duration of time between 1 date and the other, not a single time.

For example a booking will be made between 8am to 10am and they will be unavailable during that time. Not “at” 8am or 10am, but for the range of time in between.

This topic was automatically closed after 70 days. New replies are no longer allowed.