cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
imscavok
Level: Powered On

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
Super User

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

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
Super User

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

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

imscavok
Level: Powered On

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

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.

Murderbot
Level: Powered On

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

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 171 members 5,657 guests
Please welcome our newest community members: