cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (54,428)