Hello,
I have two dataverse tables: Rooms (Name, Capacity) and RoomBookings (Name, Date, Room)
Now I'm trying to create a screen where users can book a room. First they select the date. Afterwards I want the next dropdown to only show the rooms that have capacity left on this date.
Therefore I tried this filter on the "select room"-drowdown to count the bookings of each room on the selected date:
Filter(
RoomsCollection,
'Capacity' > CountIf(RoomBookingsCollection, 'Room'.'Name' = 'Name' && 'Date' = DateValue1.SelectedDate)
)
OnVisible of Screen:
ClearCollect(RoomsCollection,[@Rooms]);
ClearCollect(RoomBookingsCollection,[@RoomBookings]);
Problem is, that the formula inside CountIf is obviously wrong.
'Name' refers to RoomBookingsCollection instead of RoomsCollection. Therefore the condition doesn't do what it's supposed to do...
So what's the right way to do this?