Teo
Teo

Reputation: 1

PowerApps Filter - Show only items that are not in other table with selected date

I am making a powerapp for deskreservations at our office. I hade 2 data source tables, "Desks" and "Desk Reservations". They are both SP Lists. I have a gallery where i would like to show all desks availible for the selected date. The filter im trying to create is something like this:

Show "Desks" item IF Desks.Title IS NOT "Desk Reservations".DeskName AND selectedDate IS NOT "Desk Reservations".Date

So in other words I would like to show all "desks" items that doesnt match an item in "Desk Reservations" on the selected date..

Thanks

I have tried a lot of different filters bu can't seem to find something that works...

Upvotes: -1

Views: 2441

Answers (1)

mmikesy90
mmikesy90

Reputation: 981

Having also developed apps for workstation booking, I also faced this issue. Generally, my understanding is that in Power Apps complex filtering and using a 'not in'-type of condition will inevitably lead to a Delegation Warning when using a SP datasource.

One workaround is interpreting 'Reservations' as the implementation of a 'many-to-many' relationship between 'Desks' and dates. You could then use a scheduled flow to generate available desks in advance (one for each desk every day).

Thus, the 'reserving' of a desk is essentially just updating the record by saving the user's guid in another field. This enables you to create a filter without NOT conditions (reservationDate == selectedDate and IsEmpty(user).

Semantically, of course, the intermediary table should not be named 'Reservations', you could come up with a more appropriate name.

Upvotes: 0

Related Questions