Hi everyone, I want to load SharePoint list values into a drop down based on the datepicker value.
It is a gym booking system, that allows only 10 people to book per day.
This is the SharePoint list called 'Slots', this is how it looks like. The name of this column is 'Title'

I have another SharePoint list called 'Reservations', this is a list that I use to capture all the slots. This is how it looks like:

Now I'm doing a check before I save a booking, I check if the selected slot is free.
This is how my screen looks like

This is the code I use to check before saving the slot in the Reservations list. This is also to stop duplicates.
If(
!IsBlank(
LookUp(
Reservations,
'Desk ID' = DrpDwnFloorDeskNum.Selected.Title && ReservationDate = Text(BookingDateDatePicker.SelectedDate, "dd/mm/yyyy", "en-GB")
)
),
Notify(
"There is already a booking on the selected slot",
NotificationType.Error
),
Patch(
Reservations,
Defaults(Reservations),
{
'Desk ID': DrpDwnFloorDeskNum.Selected.Title,
ReservationDate: Text(BookingDateDatePicker.SelectedDate, "dd/mm/yyyy", "en-GB"),
StartTime: DrpDwnStartTime.Selected.Value,
EndTime: DrpDwnEndTime.Selected.Value
}
);
Navigate(Confirmation);
Reset(BookingDateDatePicker);
Reset(DrpDwnEndTime);
Reset(DrpDwnFloorDeskNum);
Reset(DrpDwnStartTime);
Reset(Gallery1);
)
But now I want to load the Slots on the screen based what date is selected and what slots are booked.
E.g if I select date '01/02/2024' and all the slots are free. Then in the dropdown showing the slots I should display all the slots.
But if I select date '01/02/2024' and Slot 1 is booked. Then in the dropdown showing the slots I should display Slots 2-10.
But if I select date '01/02/2024' and Slot 1 and Slot 2 are booked. Then in the dropdown showing the slots I should display Slots 3-10.
So I need to check the Reservations SharePoint list, then filter\display the values of the dropdown showing the slots based on the date and which slots are not appearing in the Reservations list.
So on and so on.
If all the Slots are booked, then I should tell the user that for that date, there are no available slots.
I also need to email the person who booked the slot or send them a message on Teams, so that they can have proof of the booking.