cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Delegation Issues with Filter() Function

I've got a problem with the delegation in PowerApps, which i am not able to bypass.


Situation is:
I have 2 datasources, "users" and "devices" each device can have multiple users. The data is stored in a gallery and i got a searchbar, now the goal is to search after a user and get devices as results, to do that i wrote this code:
Filter(devices;
                devicesID in
                Filter(Users,
                               Searchbar.text in User).DevicesID

)
Which makes me able to filter it correclty, but it doesn't bypass the delegation since i have more than 2000 datasets it doesnt show me them correctly.

I hope someone already had a problem similar like this and was able to figure it out.
Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
tommyly
Responsive Resident
Responsive Resident

Since there is a one (device) to many (users), I'm assuming that there is potential to have more users than devices (for the same reason you'd assume there are more cities than countries. Since each user has a Foreign Key or Foreign ID (FID) that references the devices, then you can leverage that.

 

ClearCollect(colDevices,
  AddColumns(AddColumns(Devices, "DeviceID2", DeviceID)
    "UserGroup", Filter(User, DeviceID=DeviceID2)
  )
)

Assuming that your number of devices is small and manageably safe from delegation threshold, this will create a collection of devices that has a filtered, nested collection of Users with the same DeviceID FID.

 

You can then Filter like this:

Filter(colDevices,
  SearchBar.Text in UserGroup.User
)

 

View solution in original post

2 REPLIES 2
ProjectVelox
Advocate III
Advocate III

ClearCollect the data sources first on the OnVisible or OnStart event and used the created collection on your filter. 🙂

tommyly
Responsive Resident
Responsive Resident

Since there is a one (device) to many (users), I'm assuming that there is potential to have more users than devices (for the same reason you'd assume there are more cities than countries. Since each user has a Foreign Key or Foreign ID (FID) that references the devices, then you can leverage that.

 

ClearCollect(colDevices,
  AddColumns(AddColumns(Devices, "DeviceID2", DeviceID)
    "UserGroup", Filter(User, DeviceID=DeviceID2)
  )
)

Assuming that your number of devices is small and manageably safe from delegation threshold, this will create a collection of devices that has a filtered, nested collection of Users with the same DeviceID FID.

 

You can then Filter like this:

Filter(colDevices,
  SearchBar.Text in UserGroup.User
)

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,540)