Hello, i have a problem with gallery filter. Now i'm trying to do it with excel, but it doesnt't work if i use sharepoint too. So i have two tables in Excel, first is called Floor1, where data about desks is stored with column Title (Desk 1, Desk 2 etc), and Reservation1, where data about reservations is stored with colums Title (John Doe Desk 1), DeskText (Desk 1, Desk 2, etc), CheckOutFrom (start date) and CheckOutTo (end date). Reservations write to Reservation1 successfully, but filter in my gallery doesn't work correctly. The formula I am using right now for gallery items is:
Filter(tbFloor1,Not(Title in Filter(tbReservation1,CheckOutFrom >= startTime && CheckOutTo <= endTime || CheckOutFrom <= endTime && CheckOutTo >= endTime).DeskText))
startTime and endTime are variables set on OnSelect property of Continue button after selecting dates in calendar component. In calendar component there is selected Range option.
What is working: when i select one date and reserve it, it doesn't appear in gallery, BUT
1) if i reserve, for example, Desk1 on 1st May, this desk won't show on 1st of May, but also on any date before and after 1st of May, even tho it is free (here i think problem is that when you click once on date on calendar, only CheckOutFrom is written (1/5/2021) and CheckOutTo remains blank. But if i click twice on date, then both CheckOutForm & CheckOutTo are 1/5/2021 and i am able to reserve this desk on other dates. So maybe the question is, is there a way to say to the powerapp, that if only startTime is selcted, then they should be equal with endTime, so it could understand that it is reserved for one day only?
2) If i reserve a range, for example, 3-5 May, even tho the dates will be correctly written in CheckOutFrom 3/5/2021 and CheckOutTo 5/5/2021, i will be able to reserve all these dates, 3,4,5th of May.
It is very important for my app, if someone has the answer, please, i will be very grateful!
You need to provide parenthesis around sections of your filter to establish the proper logic and order of precedence.
Please consider changing your Formula to the following:
Filter(tbFloor1, !(Title in Filter(tbReservation1, (CheckOutFrom >= startTime && CheckOutTo <= endTime) || (CheckOutFrom <= endTime && CheckOutTo >= endTime) ).DeskText ) )
I hope this is helpful for you.
Thank you, but this doesn't work. I can select same desk after date, but still cannot select the same desk before date and range still doesn't work 😞
So without scrubbing that formula, in general it is correct.
But you say that values are not getting written to the data for the start or end dates?
So let's focus on statement #1 from your original post. How are you storing data into tbReservation1 ?
Learn how to create your own user groups today!
Check out the new Power Platform Community Connections gallery!
Congratulations, the new Super User Season 2 for 2021 has started!
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.