Simply put – delegation means to assign tasks to someone else. That being said, Power Apps uses Power Apps Delegations to assign data processing tasks to data sources rather than in Power Apps itself. This limits the data brought into the application, because you might only need a handful of records out of a million from the data source.
When using an application, data is pulled from a data source using functions to display data pertaining to the specific user using the application (better known as queries). These queries use functions such as Filter and Sort to comb through rows of data in your data source until it finds the right data specified in your query to pull it into your application. Let’s look into the importance behind it and what issues can occur.
Why is it Important?
Delegation in Power Apps is crucial. Removing this task from Power Apps itself speeds up the application and improves the performance of the application for the end user. Not only this, but it decreases the load on the application. No one likes a slow app, so you only want to display information important to the end user without affecting the performance of the application. Delegation applies every time you are processing data from a data source.
Furthermore, large datasets exceeding 500 records and a function that cannot be delegated can cause your application to display incorrect results or have missing data. This is important because not everything that can be expressed and queried in a Power Apps formula can be delegated to every data source.
Possible Problems
With delegation, there are a number of issues that can occur. Bravo’s Software Engineer, Lindsay Crittendon, describes it as follows:
“Once you surpass 500 records in a data source and the function is not delegated, the application may display incorrect results, have missing data, and can affect functionality in some cases.”
An example of this could be a button that should display depending on the count of records pertaining to a specific user is reached, but the data source has more than 500 records and a non-delegable function in the query. The button might not display, because the query will pull the first 500 records.
Resolving Delegation Issues
As previously stated, delegation depends heavily on the function and data source used. Not all functions are delegable to all data sources.
The first step to resolving delegation issues is to try and prevent them in the first place. Gathering requirements as part of a traditional software development life cycle should allow you to anticipate large data sets and choose the appropriate data source for the data set. Effective requirements gathering should also allow you to anticipate what functions you might need to allow the user to focus on data they need.
General Workarounds for Delegation Warnings in Power Apps
- Always choose your data source wisely to accommodate large datasets and work with Power Apps.
- Quickest but not recommended – Increase the limit of non-delegable records from 500 to 2,000 in the app settings. This is not recommended, because it is a temporary fix should you anticipate records will exceed this amount at some point in the future.
- Limit non-delegable functions and records to 1 if possible and use delegable functions in your queries.
- Create static views where appropriate to reduce the number of records needed for functions such as additional filters.
- Scenario: Let us say I need to display all the records for employees having City = Washington, D.C., and Site = 100 and Salary >= 50,000.
- I am working with a large dataset (more than 50,000 records), and I want to filter based on the criteria above. I will have to use three filters and will face a delegation issue.
- Solution: I can create a static view specifying that the City = Washington, D.C. and call it viewWashingtonDCRecords, then I will be able to lower down the number of records to query.
- Now I only need to use two filters to further process this information for the end user.
Wrap Up
All in all, delegation in Power Apps is important for speeding up applications and improving the overall performance of the application. While there are possible issues that may arise, there are multiple ways to handle them. Luckily, if you ever get stumped, Bravo has your back! We have an entire team of trained Power Platform experts that are ready to be at your service. Learn more about our Power Platform services here.
Need help? Fill out the form below to get in touch with one of our experts!