cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
theisogunro
Helper IV
Helper IV

Delegation warning using Search() for SharePoint

I have a SharePoint list that has less than 50 items but will possibly grown more than 2000.  I have a gallery (gallery5) that I want to Search.   Here's the formula I have that give me a delegation warning.

 

The textbox name is "txtEventName" and the SharePoint column I'm searching is "Title" (single line of text)

 

Search('Job Inventory', txtEventName.Text, "Title") 

 

"Title" is underline with a double blue line with the following message:

 

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

 

Any ideas on how to fix this?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User
Dual Super User

The problem is that Search() is not a delegable function when used in SharePoint.  There are two potential workarounds

1) Use Filter(datasource, StartsWith("Title", txtEventName.Text). Filter and StartsWith are delegable functions and will work with large lists.  But they will only find records where the Title StartsWith what is in the text box.  They won't find embedded words.

2) Use Filter() on some other field to pre-filter the list down to less than 2,000 items.  Then Search() on those results.  You'll still get the delegation warning, but you can ignore it because you know the filter will get you below the threshold.  This has the advantage of being able to search for words within the "Title" field.
Search(Filter('Job Inventory',SomeOtherfield = value) txtEventName.Text, "Title")



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
Pstork1
Dual Super User
Dual Super User

The problem is that Search() is not a delegable function when used in SharePoint.  There are two potential workarounds

1) Use Filter(datasource, StartsWith("Title", txtEventName.Text). Filter and StartsWith are delegable functions and will work with large lists.  But they will only find records where the Title StartsWith what is in the text box.  They won't find embedded words.

2) Use Filter() on some other field to pre-filter the list down to less than 2,000 items.  Then Search() on those results.  You'll still get the delegation warning, but you can ignore it because you know the filter will get you below the threshold.  This has the advantage of being able to search for words within the "Title" field.
Search(Filter('Job Inventory',SomeOtherfield = value) txtEventName.Text, "Title")



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@theisogunro ,

Agreed with @Pstork1 on point 2, you have to find another condition to limit below 2000 the number the rows  returned by the SharePoint server. The get rid of delegation error at this point 2, you can use:

With(
   {FilteredDataBySharePoint:Filter('Job Inventory',SomeOtherfield = value)},
   Search(FilteredDataBySharePoint, txtEventName.Text, "Title")
)

 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,521)