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.
Solved! Go to Solution.
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.
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.
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?
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?
@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?
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.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
65 | |
51 | |
30 | |
29 | |
24 |