I am building an app which will allow users to reserve vehicles. I have two sharepoint lists, a vehicle list and a reservation list. I want to filter a gallery of vehicles based on what vehicles are available during a time slot that the user enters via dropdowns. How do I filter the gallery based on data in a different Sharepoint list? I know how I would do this with databases. Do I have to create an intermediary list of vehicle-reservations or is there a simpler way? Thanks.
Thank you, I was able to make this work!
Hi @elbent ,
To set ReservationList to contain entries from the reservations SharePoint list in PowerApps, you simply need to reference the SharePoint list directly by its name if you have already connected it to your app. If not, you'll first need to connect your app to the SharePoint list. Here's how you can do it:
Connect to SharePoint List:
Use the SharePoint List in PowerApps: Once connected, you can refer to the list directly by its name in your formulas. If the name of your reservations SharePoint list is "Reservations", you use it as follows:
Filter(
'Vehicle List',
Not(
'Vehicle Title' in Filter(
'Reservations',
(StartDate <= DatePicker_EndTime.SelectedDate) &&
(EndDate >= DatePicker_StartTime.SelectedDate)
).'Vehicle Title'
)
)
Remember to replace 'Vehicle List' and 'Vehicle Title' with the actual name of your vehicle SharePoint list and the column that contains the vehicle identifier, respectively.
Here is the code again, with the correct SharePoint list names applied:
Gallery_Vehicles.Items = Filter(
'Vehicle List',
Not(
'Vehicle Title' in Filter(
'Reservations',
(StartDate <= DatePicker_EndTime.SelectedDate) &&
(EndDate >= DatePicker_StartTime.SelectedDate)
).'Vehicle Title'
)
)
Make sure that the 'StartDate' and 'EndDate' fields are correctly named as they are in your SharePoint reservations list. This formula should now work for filtering the gallery based on the available vehicles during the selected time slot.
Please note that delegation warnings might occur if your SharePoint list is large, and the filtering criteria cannot be delegated to the SharePoint backend. In that case, you might need to pull in the entire list or use a different strategy for filtering.
Best Regards,
Hassan Raza
Hi @Hassan_SZ_365 , thanks so much for this thorough explanation. My question is how do I set ReservationList to contain the entries from the reservations Sharepoint list? Thanks.
Hi @elbent ,
Filtering a gallery in PowerApps based on availability from another list can be done directly without needing an intermediary list. You can achieve this by using a combination of Filter, LookUp, and Not functions to exclude vehicles that are already reserved within the selected time slot.
Here's a simplified approach in human-readable format:
In PowerApps, assuming you have a gallery (Gallery_Vehicles), and user inputs for start time (DatePicker_StartTime) and end time (DatePicker_EndTime), you could set the Items property of the gallery like this:
Filter(
VehicleList,
Not(
Title in Filter(
ReservationList,
(StartDate <= DatePicker_EndTime.SelectedDate) &&
(EndDate >= DatePicker_StartTime.SelectedDate)
).VehicleTitle
)
)
Explanation:
Replace VehicleList, ReservationList, StartDate, EndDate, Title, and VehicleTitle with the actual names of your lists and columns.
By setting the gallery's Items property with this formula, it should show only those vehicles that are not reserved within the selected time frame.
Best Regards,
Hassan Raza
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473