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

Delegation warning. This part "Filter" of this formula might not work correctly on large data sets

I have a PowerApp which uses SharePoint List as its data source. The app is working fine. However, a hazard icon is now appearing over my button which has a filter query on OnSelect with the following message,

 

Delegation warning. This part "Filter" of this formula might not work correctly on large data sets. The data source might not be able to process the formula and might return an incomplete data set. Your application might not return correct results or behave correctly if the data set is incomplete

 

I am using the following query,

Refresh('SpList'); Set(filteredItems, Filter('SpList', (Status.Value = "Add new" Or Status.Value = "Rejected") && Register.Email = User().Email)); 
Navigate(scrnDocPending,ScreenTransition.Cover)

This is what I am trying to achieve in the above code,

  • Refresh the SharePoint data source, SpList, for new values.
  • Filter and store the result in a global object, filteredItems.
  • Navigate to a new screen.
  • In the new screen, I am using this object, filteredItems, as a data source of a gallery.

Plz advice, how to remove this warning message?

 

12 REPLIES 12
Highlighted
Microsoft Employee

Re: Delegation warning. This part "Filter" of this formula might not work correctly on lar

Hello,

 

I think the issue is in User().Email. Try to replace it with "dummy@domain.com" and see if the warning is gone. If so then prepending Set(e, User().Email); to your formula and then replacing "...&& Register.Email = User().Email..."

with "...&& Register.Email = e..." should resolve the issue.

Community Support Team
Community Support Team

Re: Delegation warning. This part "Filter" of this formula might not work correctly on lar

Hi @piyush,

 

I guess the "Status" is the name of a Choice column. The warning shows because that the choice column(Status) is a complex field type and isn't delegable in SharePoint, which results in running your query locally (in the 500 rows).

 

Actually if you have items less than 500, then you do not need to worry about this warning. But if you did, I suggest that you whether using other column types like text/number to filter, or you can change this 500 number to 2000 by going to the File tab, selecting the App Settings in the left hand navigation pane, and looking under Experimental features. Here you will find the "Data row limit for non-delegable queries" setting which you can change from 1 to 2000. This setting is app wide. With care, you can increase this number to fit your scenario. Be aware that as you increase this number your app's performance may degrade, especially for wide tables with lots of columns.

 

Please see this post which lists all the supported delegatable predicates and functions for SharePoint.

https://powerapps.microsoft.com/en-us/tutorials/delegation-list/

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
piyush
Level: Powered On

Re: Delegation warning. This part "Filter" of this formula might not work correctly on lar

Hi @dinusc

I replaced User().Email with a dummy string "User().Email". However, the warning was still there. The warning, a blue squibble appears on the List column and not the value I am passing. For ex, in the following,

Register.Email = User().Email

warning appears on Register.Email

BlueSquibble.PNG

 

And this is happening for both the fields which are complex,

  1. User and,
  2. Choice

For choice field where I am comparing Status.value with a string, the same warning pops up. Normal data types, 

  • text,
  • number &
  • date

is working just fine. Plz advice.

piyush
Level: Powered On

Re: Delegation warning. This part "Filter" of this formula might not work correctly on lar

Thanks for your reply @v-monli-msft.

Yes, Status is of type Choice. However, it's our internal column managed by MS Flow. So, if I replace it with a string type then, I think the filter should be executed at SharePoint itself.

 

Currently, the items in the List are less than 500 but, over time it is supposed to surpass this number. Which is why I wanted the filter to be delegated to SharePoint. Because, even if the List has 2000 items, our PowerApps is expected to deal with 5-10 items max. Increasing the limit will work but will slow down the app unnecessarily. 

 

Which is why I wanted to understand is there a way to delegate the User filter to SharePoint as well? I am only using these 2 types. Changing the the choice to string might solve the first part but how to manage the User filter then?

Microsoft Employee

Re: Delegation warning. This part "Filter" of this formula might not work correctly on lar

You should be able to assign the User-related values to variables and them using them in your formula. That should address the warning. For example, pre-pend the following to your formula:

Set(e, User().Email);

... and then replace User().Email with e in your formula.

piyush
Level: Powered On

Re: Delegation warning. This part "Filter" of this formula might not work correctly on lar

Hi @dinusc

 

I have tried both the ways,

  1. Replaced User().Email with a fixed string value and,
  2. replaced it with a local variable

Still, the warning persist. If you see in the image I provided in my last reply, the blue squibble appears on my SharePoint field and not on User().Email. So, no matter what I place on the right of the equal sign, the blue squibble is constant on the left.

 

@v-monli-msft mentioned that, this might be because my SharePoint field is complex, People field (I have also highligted Choice field in my code snippet which he pointed out)! If that is the case, I am wondering how to handle it for a People field and delegate the filter on the source.

Super User
Super User

Re: Delegation warning. This part "Filter" of this formula might not work correctly on lar

Hi @piyush

 

The issues you've been facing are not to do with the User().Email function - this is client-side and not part of the delegation issue.

 

You are correct regarding the 'squiggle lines' indicating the delegation issue is due to the SharePoint field and not the User().Email - at this current point in time People picker is not a delegable item (neither are any choice or other items which involve .Value / .Id / .anything )

 

A workaround for this would be to create a new Text Column and maybe call it StatusValueActual, then have a flow set up which sets the value for these to Status.Value

 - This new column will now be Delegable

 

Now that you've solved that, you will now likely encounter that Register.Email is also not delegable - follow the same steps as above to create RegisterEmailActual, then you could re-write your code as follows:

 

Refresh('SpList');
Set(
filteredItems,
Filter(
'SpList',
(StatusValueActual = "Add new" || StatusValueActual = "Rejected") && RegisterEmailActual = User().Email
)
);
Navigate(scrnDocPending,ScreenTransition.Cover)

 

What I also like to do (if your users are only using an app and will never see the SP list), is to have this field(s) set from the app during every Edit/New action once you have all of the existing fields filled via Flow. This is to reduce the number of Flows used, however this is not a requirement if you have plenty of users and your dataset is not large or you have enough spare Flows per month/year.

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
VipulSharma
Level: Powered On

Re: Delegation warning. This part "Filter" of this formula might not work correctly on lar

Hi,

I am getting the same error. We have a list to record customer feedback and have an app to add and view feedback.

 

The app has a gallery control on which we are doing a FILTER as part of the search functionality. The query we are using is:

 

Sort(
    Filter (
        '<listName>',
        Or(
            txt_SearchInput.Text in 'Title',
            txt_SearchInput.Text in 'Call Time',
            txt_SearchInput.Text in 'Consultant Manager',
            txt_SearchInput.Text in 'Consultant Title',
            txt_SearchInput.Text in 'Consultant Name'.DisplayName
        ),
          'Created By'.Email=LoggedInUser// the variable I created to avoid using User().Email
    ),
    If(SortListBy="ConsultantName",ConsultantName.DisplayName,SortListBy="Title",Title,SortListBy="CallTime",CallTime,SortListBy="ConsultantManager",ConsultantManager,SortListBy="ConsultantTitle",ConsultantTitle),
    If (
        SortDescendingCode,
        Ascending,
        Descending
    )
)

 

The warning I am getting is : "Delegation Warning. The highlighted part of this formula might not work correctly with column "Title" on large data sets."

 

If I remove the "in" statement for 'Title', the rest of the OR comparisons stay highlighted and the error message then mentions the next column. If I remove everything from OR, the email comparison gets highlighted.

 

Thanks in advance!

Super User
Super User

Re: Delegation warning. This part "Filter" of this formula might not work correctly on lar

Hi,

 

Yes, not a problem - I see your formula uses 'in', which is not a delegable query with SharePoint.

 

You have two options at this point (three technically)

 

1. Change your 'in' to a StartsWith('Title', txt_SearchInput.Text)

Or

2. Collect your entire data source locally using ClearCollect, which can then use 'in' without issue, HOWEVER, if your data source is large, your end-users will end up waiting a Long time for it all to cache locally, and it will have to refresh and recache every time a change is made.

Or

3. Move to a data source such as Azure SQL that supports more delegable queries
(I use SharePoint for everything as well, so I understand that this is not an option everyone can use)

 

If using 1. then your formula becomes:

 

Sort(
    Filter (
        '<listName>',
('Created By'.Email = LoggedInUser) // the variable I created to avoid using User().Email
&& ( StartsWith('Title', txt_SearchInput.Text)

|| StartsWith('Call Time', txt_SearchInput.Text)
|| StartsWith('Consultant Manager', txt_SearchInput.Text)
|| StartsWith('Consultant Title', txt_SearchInput.Text)
|| StartsWith('Consultant Name'.DisplayName, txt_SearchInput.Text) ) ), If(SortListBy="ConsultantName",ConsultantName.DisplayName,SortListBy="Title",Title,SortListBy="CallTime",CallTime,SortListBy="ConsultantManager",ConsultantManager,SortListBy="ConsultantTitle",ConsultantTitle), If ( SortDescendingCode, Ascending, Descending ) )

 

Let me know how you get on with that,

Apologies for the delay in responding but work got really busy!

 

Cheers,

ManCat

 




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 179 members 6,033 guests
Please welcome our newest community members: