cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
albertov
Level: Powered On

Simplifying filter formula - Delegation warning

My app has several delegation warnings, because I am using functions of this type:

 

Filter('Source',User().FullName=User)

 

where 'Source' refers to a particular SharePoint list.

 

First of all, I do not understand why I am getting this warning, when the "Filter" function is clearly defined as delegable in SharePoint. I am thinking it probably has to do with the "User" part of the filter? Am I right?

 

I have followed instructions I found in another post, about handling "delegation warnings", and I have changed the "data row limit" to 2000. But the delegation warnings do not disappear. 

One of my lists has 1500 rows. However, it is very unlikely that the data in my lists will exceed the 2000 row limit. Does this mean that I just have to live with the warnings, and that things will work fine?

 

I can see that the app checker suggests that I try simplifying the formula. How can I do this with such a formula? Are there any other viable alternatives?

 

The app is also quite slow to load in mobile devices. Can this be related to these warnings?

I have read some posts here about this problem. Is this still an issue in general, or is it related to these warnings?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Simplifying filter formula - Delegation warning

Hi @albertov,

You are right about the delegation warning.  It comes from the User part of your formula. If you cache the user as a global variable in the OnStart function of your first screen, you will avoid the delegation warning and increase the efficiency of any searches that you subsequently do on the filtered datasource. @Meneghino has a nice blog post at Powerapps-user-function-cache-current-user-onstart/ on how to do it.  

4 REPLIES 4
Highlighted
Super User
Super User

Re: Simplifying filter formula - Delegation warning

Hi @albertov,

You are right about the delegation warning.  It comes from the User part of your formula. If you cache the user as a global variable in the OnStart function of your first screen, you will avoid the delegation warning and increase the efficiency of any searches that you subsequently do on the filtered datasource. @Meneghino has a nice blog post at Powerapps-user-function-cache-current-user-onstart/ on how to do it.  

albertov
Level: Powered On

Re: Simplifying filter formula - Delegation warning

Hi @Drrickryp

Thanks for this solution. Everything loads much faster now, except for images.

Actually, I encountered a problem with a SharePoint list containing URLs to .jpg images, which I am filtering with this method.

 

When I filter the list as before, using

 

Filter('Source',User().FullName = User)

 

there is absolutely no issue with the URLs nor the images, which show with no problems, both in the desktop and mobile versions of the app. The URLs are accessible with no restrictions. The only issue in this case is the delegation warning and loading time.

 

But when I try changing User() in this fuction with the variable created on start as Set(CurrentUser,User()) , which gives me the following function Filter('Source',CurrentUser.FullName = User), the .jpg images stop being visible on the mobile app. I am testing this in an iOS device with the lateset software. The .jpg images are still visible on the desktop version of the app (I am testing this on Chrome).

 

I have tried restaring my iOS device, uninstalling PowerApps from my iOS device and reinstalling, and I have also tried deleting cache. But the only thing that helps is reverting to Filter('Source',User().FullName = User) for the SharePoint list with the public URLs with the .jpg files (this is the only SharePoint-list in the app containing URLs that direct to .jpg) 

 

I have considered that maybe it works best with another format other than .jpg (for example .png), but I want to be sure if there are other solutions before trying this (there are several images, and these would have to be converted to -png and published again).

 

It seems as if PowerApps loses the ability to recognize an image in the URL, when this URL is transferred to the gallery through a variable.

 

Is there a way around this?

 

Thanks again.

Super User
Super User

Re: Simplifying filter formula - Delegation warning

I'm stumped. Perhaps you could post it as a new problem. One of the other advisors might know.
albertov
Level: Powered On

Re: Simplifying filter formula - Delegation warning

I tried moving this to a new post, but somehow it is not being accepted. It is either too long, or too similar to content in this thread ?