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 Apps
Answered

LastN problem

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

 

 

Hi guys,

 

I have a document library with more then 5000 records,

I used a Data Table, to filter the data I used LastN to get the latest documents. I have documents from yesterday, but it doesnot shows them.

Any suggestion?

Thank you,

LastN problem.png

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

    There was a problem with editting my message.

    Here's my filter;

    ClearCollect(TimeSheetsofProject, AddColumns(LastN (Timesheets, 100000), ....))

  • Verified answer
    R3dKap Profile Picture
    1,594 on at

    @farsami,

    There is a parameter in your application where you can set the limit of the maximum number of records to handle within one request when going through the SharePoint connector:

    Image 1.png

    The default value is 500. You can increase it up to 2000 max.

    So even if you set it to 2000 and use the LastN function to retreive (let's say) the last 100 items, it will retreive items 1900 to 2000. And if you put your whole datasource as the main datasource for a DataTable control, you will see only the first 2000 records and it's only if you scroll down to the 2000th items that the connector will retreive the next items by blocks of 100 items each.

    If you want to retreive the latest 100 items from your 5000 list items, you have 2 solutions:

    1. The easiest one is to sort your datasource on the modified date in descending order and pick the first 100 items
    2. The hardest way is to collect all 5000 items in a collection through a loop that will retreive the items by blocks of 500 items

    So I really suggest you the first option, which should look like this:

    FirstN(Sort(<yourdatasource>,Modified,Descending),100)

    I hope this helps your case...

    Emmanuel

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thx,

    It worked

     

  • Verified answer
    R3dKap Profile Picture
    1,594 on at

    Hi @farsami,

    Glad it worked ! Please select my answer as an Accepted Solution so others can find the solution easily...

    Emmanuel

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard