web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Fix Delegation Warning
Power Apps
Unanswered

Fix Delegation Warning

(0) ShareShare
ReportReport
Posted on by 44

How do I fix the delegation warning in the search portion of my filter on a gallery? I'm filtering on a SharePoint document library.

The delegation warning is on the bold characters below, &&, || and in.

Filter(
'Legal Library',
(IsBlank(cboDate.SelectedItems) || IsEmpty(cboDate.SelectedItems) || Date.Value = cboDate.Selected.Value) && (IsBlank(cboDivision.SelectedItems) || IsEmpty(cboDivision.SelectedItems) || Division.Value = cboDivision.Selected.Value) && (IsBlank(cboJudge.SelectedItems) || IsEmpty(cboJudge.SelectedItems) || Judge.Value = cboJudge.Selected.Value) && (IsBlank(TextDocket.Text) || false ||(TextDocket.Text) || Docket = TextDocket.Text) && (IsBlank(cboDocketType.SelectedItems) || IsEmpty(cboDocketType.SelectedItems) || DocketType.Value = cboDocketType.Selected.Value) && (IsBlank(cboMotion.SelectedItems) || IsEmpty(cboMotion.SelectedItems) || Motion.Value = cboMotion.Selected.Value) && (IsBlank(cboCharges.SelectedItems) || IsEmpty(cboCharges.SelectedItems) || Charges.Value = cboCharges.Selected.Value) && (IsBlank(cboTrialPrep1.SelectedItems) || IsEmpty(cboTrialPrep1.SelectedItems) || TrialPrep.Value = cboTrialPrep1.Selected.Value) && (txtSearch1.Text = Blank() || false || (txtSearch1.Text) || txtSearch1.Text in Name)

Categories:
  • geatherese Profile Picture
    16 on at

    I've found a few ways to get by the delegation errors.  First, if the initial filter reduces the amount of records in your recordset below your delegation threshold (i.e. 500) then you can remove the conditions that are giving you the warning and apply the working filters.  The results of the filter will produce a table that you can then filter with the remaining conditions. You will still see the delegation error but you'll never run into a problem since you are below your delegation limit.  

     

    Another approach that I've found quite interesting is to ensure that the conditions in your query are all using numerical values and not text. You won't encounter the delegation limits for numericals.

     

    My two cents worth..

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @GeneErz,

     

    'in' is not a delegable operator for SharePoint, a workaround would be using StartsWith(). I have also made some slight adjustments to the code which will make it more readable:

    Filter(
     'Legal Library',
     IsBlank(cboDate.SelectedItems) || IsEmpty(cboDate.SelectedItems) || Date.Value = cboDate.Selected.Value,
     IsBlank(cboDivision.SelectedItems) || IsEmpty(cboDivision.SelectedItems) || Division.Value = cboDivision.Selected.Value,
     IsBlank(cboJudge.SelectedItems) || IsEmpty(cboJudge.SelectedItems) || Judge.Value = cboJudge.Selected.Value,
     IsBlank(TextDocket.Text) || Docket = TextDocket.Text,
     IsBlank(cboDocketType.SelectedItems) || IsEmpty(cboDocketType.SelectedItems) || DocketType.Value = cboDocketType.Selected.Value, 
     IsBlank(cboMotion.SelectedItems) || IsEmpty(cboMotion.SelectedItems) || Motion.Value = cboMotion.Selected.Value,
     IsBlank(cboCharges.SelectedItems) || IsEmpty(cboCharges.SelectedItems) || Charges.Value = cboCharges.Selected.Value,
     IsBlank(cboTrialPrep1.SelectedItems) || IsEmpty(cboTrialPrep1.SelectedItems) || TrialPrep.Value = cboTrialPrep1.Selected.Value,
     //Changed to StartsWith
     txtSearch1.Text = Blank() || StartsWith(Name, txtSearch1.Text)
    )

     

    The downside to StartsWith is that the Name has to start with the provided text, it does not do a 'contains' query. Should you want to use the in operator instead, you can use nested filters:

    Filter(
     Filter(
     'Legal Library',
     IsBlank(cboDate.SelectedItems) || IsEmpty(cboDate.SelectedItems) || Date.Value = cboDate.Selected.Value,
     IsBlank(cboDivision.SelectedItems) || IsEmpty(cboDivision.SelectedItems) || Division.Value = cboDivision.Selected.Value,
     IsBlank(cboJudge.SelectedItems) || IsEmpty(cboJudge.SelectedItems) || Judge.Value = cboJudge.Selected.Value,
     IsBlank(TextDocket.Text) || Docket = TextDocket.Text,
     IsBlank(cboDocketType.SelectedItems) || IsEmpty(cboDocketType.SelectedItems) || DocketType.Value = cboDocketType.Selected.Value, 
     IsBlank(cboMotion.SelectedItems) || IsEmpty(cboMotion.SelectedItems) || Motion.Value = cboMotion.Selected.Value,
     IsBlank(cboCharges.SelectedItems) || IsEmpty(cboCharges.SelectedItems) || Charges.Value = cboCharges.Selected.Value,
     IsBlank(cboTrialPrep1.SelectedItems) || IsEmpty(cboTrialPrep1.SelectedItems) || TrialPrep.Value = cboTrialPrep1.Selected.Value
     ),
     txtSearch1.Text = Blank() || StartsWith(Name, txtSearch1.Text)
    )

    The code will provide the delegable query, after which the out filter applies the non-delegable query to that output.

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • geatherese Profile Picture
    16 on at

    The nested filters is what I had previously proposed but this will only work if your dataset is smaller than your delegation limit.

  • GeneErz Profile Picture
    44 on at

    Thank you for your response and suggestion. I'm still getting the delegation warning with your nested filters. The document library is at 1120 files and is expected to grow 10 times that. In bold at the end is where the delegation warning is:

    Filter(
    Filter(
    'Legal Library',
    IsBlank(cboDate.SelectedItems) || IsEmpty(cboDate.SelectedItems) || Date.Value = cboDate.Selected.Value,
    IsBlank(cboDivision.SelectedItems) || IsEmpty(cboDivision.SelectedItems) || Division.Value = cboDivision.Selected.Value,
    IsBlank(cboJudge.SelectedItems) || IsEmpty(cboJudge.SelectedItems) || Judge.Value = cboJudge.Selected.Value,
    IsBlank(TextDocket.Text) || Docket = TextDocket.Text,
    IsBlank(cboDocketType.SelectedItems) || IsEmpty(cboDocketType.SelectedItems) || DocketType.Value = cboDocketType.Selected.Value,
    IsBlank(cboMotion.SelectedItems) || IsEmpty(cboMotion.SelectedItems) || Motion.Value = cboMotion.Selected.Value,
    IsBlank(cboCharges.SelectedItems) || IsEmpty(cboCharges.SelectedItems) || Charges.Value = cboCharges.Selected.Value,
    IsBlank(cboTrialPrep1.SelectedItems) || IsEmpty(cboTrialPrep1.SelectedItems) || 'Trial Prep'.Value = cboTrialPrep1.Selected.Value
    ),
    txtSearch1.Text = Blank() || StartsWith(
    Name,
    txtSearch1.Text
    )
    )

  • GeneErz Profile Picture
    44 on at

    How would I incorporate numerical values?

  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    @GeneErz ,

    Just adding a variation here - this will get rid of the warning, but only really "masks" it and relies on the top filter returning results (when the appropriate controls are populated) under your Delegation limit 

    With(
     {
     _Data:
     Filter(
     'Legal Library',
     (Len(cboDate.Selected.Value) = 0 || Date.Value = cboDate.Selected.Value) && 
     (Len(cboDivision.Selected.Value) = 0 || Division.Value = cboDivision.Selected.Value) && 
     (Len(cboJudge.Selected.Value) = 0 || Judge.Value = cboJudge.Selected.Value) && 
     (Len(TextDocket.Text) = 0 || Docket = TextDocket.Text) && 
     (Len(cboDocketType.Selected.Value) = 0 || DocketType.Value = cboDocketType.Selected.Value) && 
     (Len(cboMotion.Selected.Value) = 0 || Motion.Value = cboMotion.Selected.Value) && 
     (Len(cboCharges.Selected.Value) = 0 Charges.Value = cboCharges.Selected.Value) && 
     (Len(cboTrialPrep1.Selected.Value) || TrialPrep.Value = cboTrialPrep1.Selected.Value) 
     )
     },
     Filter(
     _Data,
     Len(txtSearch1.Text) = 0 || txtSearch1.Text in Name
     )
    )

    Note that the Len() parameter covers both blank and empty. You can also get a bit more sophisticated with this (gets a bit bulky, but works fine) - use whatever your Delegation limit is where I have 500.

    With(
     {
     _Data:
     Filter(
     'Legal Library',
     (Len(cboDate.Selected.Value) = 0 || Date.Value = cboDate.Selected.Value) && 
     (Len(cboDivision.Selected.Value) = 0 || Division.Value = cboDivision.Selected.Value) && 
     (Len(cboJudge.Selected.Value) = 0 || Judge.Value = cboJudge.Selected.Value) && 
     (Len(TextDocket.Text) = 0 || Docket = TextDocket.Text) && 
     (Len(cboDocketType.Selected.Value) = 0 || DocketType.Value = cboDocketType.Selected.Value) && 
     (Len(cboMotion.Selected.Value) = 0 || Motion.Value = cboMotion.Selected.Value) && 
     (Len(cboCharges.Selected.Value) = 0 Charges.Value = cboCharges.Selected.Value) && 
     (Len(cboTrialPrep1.Selected.Value) = 0 || TrialPrep.Value = cboTrialPrep1.Selected.Value) 
     )
     },
     If(
     CountsRows(_Data) < 500
     Filter(
     _Data,
     Len(txtSearch1.Text) = 0 || txtSearch1.Text in Name
     ),
    	 Filter(
     'Legal Library',
     (Len(cboDate.Selected.Value) = 0 || Date.Value = cboDate.Selected.Value) && 
     (Len(cboDivision.Selected.Value) = 0 || Division.Value = cboDivision.Selected.Value) && 
     (Len(cboJudge.Selected.Value) = 0 || Judge.Value = cboJudge.Selected.Value) && 
     (Len(TextDocket.Text) = 0 || Docket = TextDocket.Text) && 
     (Len(cboDocketType.Selected.Value) = 0 || DocketType.Value = cboDocketType.Selected.Value) && 
     (Len(cboMotion.Selected.Value) = 0 || Motion.Value = cboMotion.Selected.Value) && 
     (Len(cboCharges.Selected.Value) = 0 Charges.Value = cboCharges.Selected.Value) && 
     (Len(cboTrialPrep1.Selected.Value) = 0 || TrialPrep.Value = cboTrialPrep1.Selected.Value) 
     )
     )
    )

    then the Visible of the Search Box

    With(
     {
     _Data:
     Filter(
     'Legal Library',
     (Len(cboDate.Selected.Value) = 0 || Date.Value = cboDate.Selected.Value) && 
     (Len(cboDivision.Selected.Value) = 0 || Division.Value = cboDivision.Selected.Value) && 
     (Len(cboJudge.Selected.Value) = 0 || Judge.Value = cboJudge.Selected.Value) && 
     (Len(TextDocket.Text) = 0 || Docket = TextDocket.Text) && 
     (Len(cboDocketType.Selected.Value) = 0 || DocketType.Value = cboDocketType.Selected.Value) && 
     (Len(cboMotion.Selected.Value) = 0 || Motion.Value = cboMotion.Selected.Value) && 
     (Len(cboCharges.Selected.Value) = 0 Charges.Value = cboCharges.Selected.Value) && 
     (Len(cboTrialPrep1.Selected.Value) = 0 || TrialPrep.Value = cboTrialPrep1.Selected.Value) 
     )
     },
     CountsRows(_Data) < 500
    )

    This way the search box will not appear unless the output of the top filter gets under your Delegation limit.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • GeneErz Profile Picture
    44 on at

    Received a couple of errors that I can see:

    Invalid number of arguments, received 3 expected 2.    right after With

    CountRows is an unknown or unsupported function    at the CountRows

  • geatherese Profile Picture
    16 on at

    Hello,  perhaps you are already driving toward a path forward but I'll answer your question about adding numericals as it's a good practice.  You just use the ID number associated with the information that you're looking up.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard