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 / How do I filter a gall...
Power Apps
Answered

How do I filter a gallery that is connected to a SharePoint list without running in to delegation issues?

(0) ShareShare
ReportReport
Posted on by 32

I have two SharePoint lists that are connected by Product ID. One list is called ExpiryJournal and the other list is called Products.

 

This is the items property for the gallery that has a delegation warning:

 

 

Items = Filter(ExpiryJournal, ProductID in Products.ProductID, Archived=0)

 

 

ProductID and Archived are columns in SharePoint and are both numeric data types.

 

I also have another delegation warning for a dropdown menu on another screen, which has this items property:

 

 

Items = Filter(Products, txtinpFindProduct.Text in ProductName || txtinpFindProduct.Text in Barcodes)

 

 

Barcodes and ProductName are columns in SharePoint and are both single lines of text data types.

 

Both bits of code work and I'm able to get the results I'm looking for, but both have a yellow delegation warning symbol next to them which I'd like to resolve. Please show me (with code) how I can modify these two items so that I no longer have delegation issues.

Categories:
I have the same question (0)
  • RezaDorrani Profile Picture
    12,145 on at

    Hi @VINdicated09 

     

    In is not a delegable operation with SharePoint.

     

    For a complete list of delegable queries with SharePoint

    https://docs.microsoft.com/en-us/connectors/sharepointonline/#power-apps-delegable-functions-and-operations-for-sharepoint

     

    Also, check out my playlist on Power Apps delegation & SharePoint.

    I have highlighted some tricks to avoid the delegation warnings

    https://www.youtube.com/playlist?list=PLTyFh-qDKAiE6ia-D94Qk5-AzpN4dqOmD

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

    Thanks,
    Reza Dorrani, MVP
    YouTube
    Twitter

  • VINdicated09 Profile Picture
    32 on at

    Thank you. Yes the in part has the blue lines under it. I have seen your videos before reaching out on here but I'm still not able to solve this issue. I've tried using = for the gallery but it still isn't working. Are you able to see where I'm going wrong?

  • RezaDorrani Profile Picture
    12,145 on at

    Hi @VINdicated09 --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

    Thanks,
    Reza Dorrani, MVP
    YouTube
    Twitter

     

    You cannot use the IN operator with SharePoint as it is not delegable.

    Your queries are using the IN operator.

     

     

  • VINdicated09 Profile Picture
    32 on at

    Are you able to show me what my code should look like? I know it isn't supposed to have in and I've seen the delegable list and your videos, but I don't know what to type to get rid of the warnings

  • VINdicated09 Profile Picture
    32 on at

    I've managed to solve one issue myself using startwith but I'm still struggling with this one..

    Filter(ExpiryJournal, ProductID in Products.ProductID, Archived=0)

     

    If you can help with this I'd appreciate it 

  • Max44 Profile Picture
    223 on at

    If your data source is SharePoint then there is no way to get around delegation warning (and incomplete results) for large lists when filtering with dates.

    Please reference the Delegable function, operations and column types for more information on what you can and cannot do.

    So, the reality is, the only real problem you are having with that formula is that it works in one environment and not another.

    Consider changing the formula to the following:

    If (Month_1.SelectedText.Value = "January";
    Filter ('Hours_Inverted';
    'Activity date' >= Date(2018,12,25) &&
    'Date of activity' <= Date(2019,1,24)
    )
    )
    You don't need to convert your column date to text and then back to a date again. Also, the Date function will be a bit more reliable in this case.

     

    NOW...that would only deal with the issue of working on other devices. This does NOT resolve the delegation issue.

    That is going to take more work.

     

    In order for you to be able to delegate queries/filters on that list, you will need to do it by a delegable function and column type. You could use a number or text to do this.

    A solution you can use is to set up a Flow/Workflow on your list that when an item is created or changed, to have the Flow/Workflow copy the date value to a delegable column type. So, for example, you could have it copy into a number column or a string column IN THE FOLLOWING FORMAT - yyyymmdd

    Now, once that is in place, you can use < or > on the numeric column without delegation issues. Or StartsWith on the text column.

    Ex.

    Numeric - 'Activity Date Num' - Value: 20190102

    You can use 'Activity Date Num' <= Date(2019, 2, 1) without delegation issues

     

    Text - 'Activity Date Text' - Value: "20190102"

    You can use StartsWith('Activity Date Text', "201901") to return all of Jan 2019 items without delegation issues.

     

    Admin

    Apps4rent

  • VINdicated09 Profile Picture
    32 on at

    Thanks for your message but my question isn't about dates. It's about numeric data types.

     

    This is the gallery code for its items property:

     

    Filter(ExpiryJournal, ProductID in Products.ProductID, Archived=0)

     

    ExpiryJournal and Products are SharePoint lists

    ProductID and Archived are columns in those lists both with numeric data types.

     

    This line of code still works but it shows a delegation warning. I would appreciate it if you could re-write the above line of code for me so that it filters the gallery as intended but without any delegation issues

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @VINdicated09 

    I would like to help you here.  Could you say how many items are in your two lists, ExpiryJournal and Products?  Do you project that either of these two lists will exceed 2000k items in the future?  Can you limit the Journal to the last 2000k items to be filtered or do you need to be able to filter the entire list? Finally, is the Products list changed or added to frequently or does it stay the same? 

  • VINdicated09 Profile Picture
    32 on at

    Thanks @Drrickryp 

     

    ExpiryJournal currently has 14 items but gets added to all the time. When a journal has been completed, I can run a flow that archives completed entries, so I don't see this list exceeding 2000 rows.

     

    The products table on the other hand is a list of unique SKUs with barcodes and this could exceed 2000 rows in the future. I would like to be able to filter the entire list.

     

    The products list does get added to whenever a new product hits the shelves, but existing items do not get updated. They tend to stay the same as the barcode never changes.

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @VINdicated09 

    One way to get around this is to create a collection of your Products list.  If it is unlikely to ever exceed 4000 items you can use this trick.  In the OnStart of your app put the following 

     

     

     

     

     

    Concurrent(
     ClearCollect(
     colProductsA,Sort(
     Products,ID,Ascending
     )
     ),
    ClearCollect(
     colProductsD,Sort( 
     Products,ID,Descending
     )
     )
     ) ;
    ClearCollect(
     allProducts,colProductsA, Filter(
     ColProductsD, Not(
     ID in colProductsA.ID
     )
     )
     )

     

     

     

     

     

    This will create a collection called allProducts.  The first two lines are obvious and the third line combines the two collections and eliminates duplicates caused by combining the two collections. (I think the parentheses are correct in my formula).  This collection, allProducts can be used in your formulas without worrying about delegation errors.    

     

     

     

     

    Items = Filter(colProducts, txtinpFindProduct.Text in ProductName || txtinpFindProduct.Text in Barcodes)

     

     

     

     

    You could put a warning in your app that appears if the number of products approaches 4k something like

    a Label with the text property "You have "&CountRows(colProducts)&" in your list." and make the visible property of the label 

    CountRows(colProducts)>3995 .  If your products list gets to be more than 4k you will have a more complicated problem to solve. There are ways to do it but it definitely becomes more difficult and requires using a flow. 

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard