Delegation in PowerApps Controls

Delegation is a fundamental concept in PowerApps that allows the app to delegate certain operations to the data source instead of processing them locally. By doing so, the app can efficiently process large data sets and avoid performance issues.

However, not all operations can be delegated, and there are limitations to the types of operations that can be delegated. This can be especially challenging when working with dropdown and gallery controls in PowerApps. In this blog post, we will explore how to manage delegation in dropdown and gallery controls in PowerApps.

Dropdown control

The dropdown control in PowerApps is commonly used to display a list of items from a data source. By default, the dropdown control will delegate the Select and Filter functions to the data source. However, there are limitations to the types of operations that can be delegated.

For example, if you have a large data set with more than 2,000 items, the dropdown control will not be able to delegate the Select and Filter functions, and you will see an error message similar to the following:

The requested operation is not supported for this data source.

To work around this issue, you can limit the number of items returned by the data source by using the Filter function to filter the data set based on a search term entered by the user.

Here's an example of how to do this:

  1. Add a dropdown control to your PowerApp.
  2. Set the Items property of the dropdown control to a data source that contains a large number of items (e.g. more than 2,000).
  3. Add a text input control to your PowerApp.
  4. Set the OnChange property of the text input control to the following formula:
    Set(varSearchTerm, TextInput1.Text);
    This will set a variable varSearchTerm to the value entered by the user in the text input control.
  5. Set the Items property of the dropdown control to the following formula:
    Filter(<data source>, <field> in varSearchTerm)
    Replace <data source> with the name of your data source and <field> with the name of the field you want to filter by.

This will limit the number of items returned by the data source to only those that match the search term entered by the user.

Gallery control

The gallery control in PowerApps is commonly used to display a list of items from a data source. By default, the gallery control will delegate the Select and Filter functions to the data source. However, there are limitations to the types of operations that can be delegated.

For example, if you have a large data set with more than 2,000 items, the gallery control will not be able to delegate the Select and Filter functions, and you will see an error message similar to the following:

The requested operation is not supported for this data source.

To work around this issue, you can use the LoadMoreData function to load additional items from the data source as the user scrolls through the gallery control.

Here's an example of how to do this:

  1. Add a gallery control to your PowerApp.
  2. Set the Items property of the gallery control to a data source that contains a large number of items (e.g. more than 2,000).
  3. Set the TemplateFill property of the gallery control to a template that displays the fields you want to show for each item in the data source.
  4. Set the OnSelect property of the gallery control to the following formula:
Navigate(<next screen>, {SelectedItem: Gallery1.Selected})

Replace <next screen> with the name of the screen you want to navigate to when the user selects an item in the gallery control.

HCL Tech
HCL Tech