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 / Sharepoint Delegation
Power Apps
Answered

Sharepoint Delegation

(0) ShareShare
ReportReport
Posted on by 46

I've been having some trouble with PowerApps throwing me delegation warnings when working with a Sharepoint list.

 

Here is the code I'm using to pull in Sharepoint list data in "chunks" of 500 at a time.

 

- 'eRad Cases' - Sharepoint List I am pulling data from

- miniID : calculated Numeric sharepoint field that is an auto-incremented integer (NOT the original ID that is assigned to each record)

- colMiniCaseList : collection generated from the Sharepoint list

 

UpdateContext({ctxMinRecID:First(SortByColumns('eRad Cases',"miniID",Ascending)).miniID});
UpdateContext({ctxMaxRecID:First(SortByColumns('eRad Cases',"miniID",Descending)).miniID});
UpdateContext({ctxNumberofPasses:RoundUp((ctxMaxRecID-ctxMinRecID)/500,0)});
ClearCollect(colNumbersTable,Filter('[dbo].[NumbersTest]',Number<=ctxNumberofPasses));
ForAll(colNumbersTable,Collect(colMiniCaseList,Filter('eRad Cases',miniID>=ctxMinRecID+((Number-1)*500) && miniID<ctxMinRecID+(Number*500)))

- ctxMinRecID : minimum record ID grabbed from Sharepoint list

- ctxMaxRecID : maximum record ID grabbed from Sharepoint list

- ctxNumberofPasses : determines how many "chunks" of 500 I need in order to download the entire list

- '[dbo].[NumbersTest]' : used to generated colNumbersTable ... simply used as an ordered list in order to record how many records need to be pulled

 

 

My issue is that somewhere in my code, PowerApps doesn't think that the Sharepoint list is delegable, which I feel stems from the First() function. I previously had this set up with a SQL database and PowerApps has no issue delegating the First(SortByColumns( '[dbo]' )), given the SortByColumns() already delegated through the SQL database and First() was just grabbing the first value in the list ... thus no flags were thrown (and data was fully retrieved.)

 

So, should Powerapps have been throwing me a flag when delegating this on a SQL database, or should the flag be ignored when delegating this on a Sharepoint list?

 

 

EDIT : It has to do with the ( + ) .... should have combed the documentation a bit better ...

 

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    adding in @Chris to assist 

     

    @Anonymous

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hey @Anonymous this sounds like a job for @mr-dang

  • Verified answer
    Mr-Dang-MSFT Profile Picture
    Microsoft Employee on at

    Hi @James_Hellfeier,

    I have a couple recommendations here. 

    First, I would put in the range to compare against inside colNumbersTable itself. Big idea: If you can relocate your calculation into a collection ahead of time, you'll gain back performance when filtering against it later.

     

    Ex. 

    If the first id is #1234, then

    Loop 1 would retrieve rows 1234-1735

    Loop 2 would retrieve rows 1734-2235

     

    This can be done by adding columns to colNumbersTable 

    ClearCollect(colNumbersTable,
     AddColumns(
     Filter('[dbo].[NumbersTest]',Number<=ctxNumberofPasses),
     "min",ctxMinRecID+((Number-1)*500),
     "max",ctxMinRecID+(Number*500)
     )
    )

    This means, "Create a collection of numbers that will be used for telling PowerApps how many times to get 500 records at a time. For each n, pre-determine what minimum to maximum range of id numbers would be."

     

    Then you would revise your collection of records to reference the min and max.

    Clear(colMiniCaseList);
    
    ForAll(colNumbersTable,
     Collect(colMiniCaseList,
     Filter('eRad Cases',
     miniID>=min,
     miniID<max
     )
     )
    )

    While this scenario is possible, I am curious why you are using a combination of SharePoint and SQL in this way. If you migrate your data to SQL which you already have, you can create SQL Views to aggregate your data in commonly used views. 

    https://powerapps.microsoft.com/en-us/blog/using-sql-server-views-in-powerapps/

     

    You'll find that when you bring in tens or hundreds of thousands of records into your app, it will take a performance hit. This is why even first party apps page their data.

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 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard