I have a Power Apps app in which I'm trying to build time slots. To do this, I modified the calendar function. The result should be that I select a date on my calendar (global variable =_dateSelected) and depending on the date selection, the available time slots are displayed to me in a gallery. Then I select a time slot and book it. This time slot disappears in the gallery for the next user (see the attachment). I patch the booked time slots into a sharepoint list, which should be used for comparison with the time slots that have already been booked.
I fail at two things:
1. How do I get the calendar day to relate to the gallery? I tried comparing _dateSelected and my values ​​in the Gallery, but that doesn't work. I created the values ​​in the gallery with a collection (see attachment 2).
2. How do I ensure that my collection values ​​and the booked values ​​in the sharepoint list can be compared with each other so that time slots that have already been booked are removed from the gallery?
To achieve your goal of displaying available time slots based on the selected date and ensuring that booked time slots are removed from the gallery, you can follow these steps: Step 1: Relate the Calendar Day to the Gallery
Create a Collection for Time Slots:
First, create a collection that holds the available time slots for each day. This collection can be created when the app starts or when a date is selected.
// Create a collection for booked slots from SharePoint list ClearCollect(BookedSlots, Filter(SharePointList, Date = _dateSelected) );
// Remove booked slots from available time slots ClearCollect(AvailableSlots, RemoveIf(TimeSlots, Date = _dateSelected && Time in BookedSlots.Time ) );
Bind the Gallery:
// Bind the gallery to the available slots collection Gallery.Items = AvailableSlots
Considerations
Ensure Data Consistency: Make sure the date format in the TimeSlots collection and the SharePoint list are consistent.
Was this reply helpful?YesNo
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.