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

Get items returning more than 1 item

I'm running to an issue where I'm running a Get items action for a sharepoint list and just want it to return one item.
Top Count = 1 

Pagination = 20,000

 

However, I keep getting a return of two items. It seems like top count doesn't work. Also, how can I just get the first item to return? I believe there's an expression I can use in the apply to each.

Objective:

I'm trying to capture the ID for the first item with a variable.

 

Get_Items.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

So here is what I think is going on.  Turning on Pagination will divide up the records into paged groups and apply your OData filter to each group.  That's why you are getting 2 items returned.  They are the top item from each page.

 

But when using an OData query you don't need to worry about pagination unless you are returning more records than the max record count. This is because the query is actually evaluated on the server.  So in your case the query will never return more than one record, but it will return up to one record for each page of results.

 

I ran a test on a large list I have with 5,101 records in it and it worked fine only returning one record even with pagination turned off.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

5 REPLIES 5
Highlighted
Super User III
Super User III

@lui 

I just ran a quick test and Top count dies work for me as designed.

Try turning pagination off.  I don't believe that it should impact your results.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted

I need to since I have more than 5000 items in the SP list. Is it possible to add expression on the Apply to each step to get/select the first item?

Highlighted

@lui 

The 5000 limit refers to the fact that SharePoint will return a maximum of 5000 items.  You are filtering your results and limiting to 1 on the server side.  Therefore, pagination should not be necessary (you are returning a single item).

@Pstork1 would you care to chime in?

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted

@ScottShearer doesn't pagination allow us to grab more than 5000 times before the filter?

The reason I began to use pagination because this sharepoint list (consists of 10000+ items) was not returning any items. Let's say I need two items to return: ID 100 and ID 10000. Without Pagination, the get items wouldnt return both regardless of the filter. Is this not correct?

Highlighted
Dual Super User III
Dual Super User III

So here is what I think is going on.  Turning on Pagination will divide up the records into paged groups and apply your OData filter to each group.  That's why you are getting 2 items returned.  They are the top item from each page.

 

But when using an OData query you don't need to worry about pagination unless you are returning more records than the max record count. This is because the query is actually evaluated on the server.  So in your case the query will never return more than one record, but it will return up to one record for each page of results.

 

I ran a test on a large list I have with 5,101 records in it and it worked fine only returning one record even with pagination turned off.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

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.

Top Solution Authors
Top Kudoed Authors
Users online (13,232)