cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

LastN problem

 

 

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

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User
Super User

Re: LastN problem

@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

View solution in original post

Highlighted
Super User
Super User

Re: LastN problem

Hi @farsami,

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

Emmanuel

View solution in original post

4 REPLIES 4
Highlighted
Helper II
Helper II

Re: LastN problem

There was a problem with editting my message.

Here's my filter;

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

Highlighted
Super User
Super User

Re: LastN problem

@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

View solution in original post

Highlighted
Helper II
Helper II

Re: LastN problem

Thx,

It worked

 

Highlighted
Super User
Super User

Re: LastN problem

Hi @farsami,

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

Emmanuel

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (2,261)