Delegation Warnings in Power Apps

We have all seen them, Delegation Warnings, but what is delegation and how do you clear your Power Apps from these warnings


Delegation

I’m going to start this post by explaining Delegation.


In Power Apps you can connect to all sorts of data sources. Often people use SharePoint, SQL Server or Dataserve ( a.k.a. Common Data Services) to store their data for their Power Apps.


Within the apps you can now collect all the records and then use a filter to select the items.

ClearCollect(colActiveOrders, 
             Filter('Orders', 
                    IsBlank(Status.Value)
             )
);

If a function within a connector is delegable then the processing can be done at the datasource end. If not, well … then your app will be doing all the hard work.


What do you think is better?


In the olden days when there was SharePoint on-premises ( Sorry if you still are in the olden days, I can help you with that! ), we had the choice to run code server side or client side. This is very similar.


Delegation warnings

There are many variations of the Delegation warnings. In this section I’m looking at a few examples.


The “Filter” part of this formula might not work correctly on large data sets

The highlighted part of this formula might not work correctly on large data sets. The “CountRows” operation is not supported by this connector.



The highlighter part of this formula might not work correctly with colum “…” on large data sets.


When to worry about Delegation Warnings


You might have noticed that all of these warnings use the word might, so there will be some cases that things might not work!


For each connector that you use you will have to check if they support delegation.


On the SharePoint connector documentation page there is a clear overview of the delegable functions.



Note that there are a few notes there.


On of the improtant ones are, formula such as

Filter(..., IsBlank(CustomerId))

won’t delegate to SharePoint. the following however will delegate:

Filter(..., CustomerId = Blank())

Interesting! so as you code your solutions. Don’t just make it work, make it work better!


When not to worry

If you use smaller datasets, then you don’t need to worry too much. Remember when you bought that new hard-disk fro your new computer in the 90s? You would never fill that one. Now you probably fill that disk with one document.


How to fix delegation warnings?

First of all when you use a datasource that supports delegation make sure that you get familiar with the delegable functions. then as you find the delegation warnings in your app find alternative ways of doing the same. Like the earlier mentioned isBlank function.


Source: Paper.li

0 comments