cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
imscavok
Regular Visitor

Getting the latest 500 SharePoint List records before using non-delegation functions

I'm working on my first PowerApp, and I'm not 100% on the delegation stuff. 

 

My app will be used to view 80-100 records that are added each week to a SharePoint List. Those records being need to be available in the app for a few weeks, but any longer isn't really necessary as long as they can be accessed via the list itself for special cases.  So limiting the app to 500 records is perfectly fine.

 

However, I have some filters on the Gallery that cannot be delegated. This means that after 5-6 weeks when there are over 500 records, the app will stop showing anything new because it pulls the first 500 records in the list and not the last 500.

 

Is there a way I can reverse which 500 records it pulls, maybe in the List itself? Is it possible to do nested filters so the first filter pulls the latest 500 records, which in turn passes them to the functions that can't be delegated?

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User II
Super User II

Hi @imscavok,

Sort is always delegated and SharePoint adds a sequential ID to every record. If you sort your list with Sort(yourlist,ID,Descending) shouldn’t run into delegation problems and warnings as long as you use Filter() and StartsWith() to search your data. 

 

Tip: all new users should review the Powerapps documents https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview and https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-list#prerequisites

View solution in original post

3 REPLIES 3
Drrickryp
Super User II
Super User II

Hi @imscavok,

Sort is always delegated and SharePoint adds a sequential ID to every record. If you sort your list with Sort(yourlist,ID,Descending) shouldn’t run into delegation problems and warnings as long as you use Filter() and StartsWith() to search your data. 

 

Tip: all new users should review the Powerapps documents https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview and https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-list#prerequisites

View solution in original post

I have non-delegatable functions within my filter function, including a togglable filter to check if if the record is from this calendar week, and a switch to filter based on categories in a drop down box. Putting the delegatable Sort on the outside of this function is still pulling from the beginning of the list rather than the end. Is it possible to get the latest records without delegation of every function?

 

Sort(Filter('Weekly Report',If(Toggle1.Value= true , true ,Created>=DateAdd(Today(),1-Weekday(Today(),StartOfWeek.Sunday))),StartsWith(Title,TextSearchBox1.Text),Switch(Category_DD.Selected.Value,Category_x0020__x0023_1.Value, true ,Category_x0020__x0023_2.Value, true ,Category_x0020__x0023_3.Value, true ,Category_x0020__x0023_4.Value, true ,Category_x0020__x0023_5.Value, true ,"All Categories", true )),ID,Descending)

 edit: Nevermind, I put the sort where the 'Weekly Report' is and that seems to have made it work.

Adding sort(yourlistname,ID,descending) to the filter worked for me!  Quick and easy way to show the most recent items and get around the 500 item limit!  For example:

 

Filter(Sort(YourListName, ID,Descending), StartsWith(Site.Value,sortVar), Month(itemDate) = _Month)

 

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,426)