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 / Delegations explanatio...
Power Apps
Unanswered

Delegations explanation required.

(0) ShareShare
ReportReport
Posted on by 95

Hi All,

 

I have watched a few videos on delegations to try and get my head around how it works in relation to a SharePoint data source.  I thought I had it figured out but need a little help.   I have a gallery linking to my SharePoint list.  Above the gallery I have 2 filters that are applied to the gallery - one for Request Type and one for Assigned To.  I got the code to work and checked it was fully delegable by reducing the Data row limit to "1".  

 

everdingk_0-1694943842577.png

 

If I add just add a Sort function as shown below, the gallery only returns 1 item.  I realise Sort is not delegable, but from what I have watched, SharePoint should still be returning all items that match the original Filters and then sorting what's returned.

 

If someone could explain why this doesn't work please?  thanks

 

everdingk_1-1694944400497.png

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,543 Most Valuable Professional on at

    Did you change the Data Row limit back from something other than 1? If the Data Row limit is only 1 then the Sort will never return more than one record. The point of the test is that if the record returned isn't the first physical record then the commands are delegable. But it will never return more than the data row limit.

  • everdingk Profile Picture
    95 on at

    thanks @Pstork1.  Yes I think I have my head around this now.  Just wasn't thinkging about it the right way....So I changed the row limit to 3 and I was getting the first 3 items that matched.... not the first 3 items in the data source... which is exactly what I want.  

     

     

  • WarrenBelz Profile Picture
    155,649 Most Valuable Professional on at

    @everdingk ,

    @Pstork1 has explained the first part of the issue, however Sort() is Delegable in SharePoint - I did not dissect your code fully, but I think that it could be condensed to this (which should be Delegable)

    Sort(
     Filter(
     FinOpsRequests,
     (
     JobStatus = "Received" || 
     JobStatus = "Allocated" || 
     JobStatus = "Queried"
     ) && 
     (
     Dropdown_RequestTypeFilter.Selected.Value = "All” ||
     ReqType = Dropdown_RequestTypeFilter.Selected.Value
     ) &&
     (
     Dropdown_AssignedToFilter.Selected.Value - "All" ||
     AssignedTo.DisplayName = Dropdown_AssignedToFilter.Selected.Value
     )
     ),
     ID,
     SortOrder.Ascending
    )

    Also please remember in future to also post your code in Text.

     

    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

  • everdingk Profile Picture
    95 on at

    Ok so I have another very simple Gallery.  I have my Data row limit set to 1 and my Gallery is showing all items.  So the following code must be delegable.

    Sort(
     Filter(
     FinOpsRequests,
     'Created By'.Email = varUserEmail
     ),
     ID,
     SortOrder.Descending
    )

     If I now add a filter, shouldn't I get one record - the first record that matches?  With this code, I get zero results.  Shouldn't the delegable part run first and return all matching results, but then the delegation limit applies to the "in" part and only returns one match from that filter?  Is that how this should work?

     

    Filter (
     Sort(
     Filter(
     FinOpsRequests,
     'Created By'.Email = varUserEmail
     ),
     ID,
     SortOrder.Descending
     ),
     TextSearchBox1_4.Text in Title
    )

     

     

  • WarrenBelz Profile Picture
    155,649 Most Valuable Professional on at

    Hi @everdingk ,

    No - the code Power Apps sends to SharePoint is everything inside the outer filter. A lot of users would love what you are saying to be true as it would almost completely overcome Delegation limitations (and they would not have to pay for Premium Data Sources a lot of the time). 
    If you do this however

    With(
     {
     _Data:
     Sort(
     Filter(
     FinOpsRequests,
     'Created By'.Email = varUserEmail
     ),
     ID,
     SortOrder.Descending
     )
     },
     Filter(
     _Data,
     TextSearchBox1_4.Text in Title
     )
    )

    the query in the With() statement is sent to the data source and will return record numbers (the list can be of any size) up to your Delegation limit, which is them queried again "locally" hence not being subject to further limitation. Be aware if you set your limit to 1, you will only get one record (the same as you would doing a collection) as you have instructed Power Apps to limit anything stored locally to this.

     

    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

  • everdingk Profile Picture
    95 on at

    Sorry, can you explain this further.  What is the With "_data" part doing?   This part is not recognised when I paste into power apps.   thanks again

  • WarrenBelz Profile Picture
    155,649 Most Valuable Professional on at

    @everdingk ,

    I have a blog on this subject that may be of use to you. The code I posted should work in the Items of a Gallery - what is not recognised ?

  • everdingk Profile Picture
    95 on at

    It's underlined the _

    Data: part

     

    everdingk_0-1695088281858.png

     

     

  • WarrenBelz Profile Picture
    155,649 Most Valuable Professional on at

    @everdingk ,

    Misplaced bracket - dangers of free-typing code - now fixed.

  • everdingk Profile Picture
    95 on at

    Hi @WarrenBelz , which bracket is out of place?  thanks

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 395

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 287 Super User 2026 Season 1

Last 30 days Overall leaderboard