cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jdeschuymere
Frequent Visitor

Get Items from sharepoint list takes double rows

Hi,

 

I have 2 flows that take input from the same sharepoint list. This is a list that keeps track of the ordered lunch from co-workers.

The flow is built to give a monthly overview of what they ordered and what they have to pay.

If I look in the list I have 158 entries, but the flow goes over 161 records. If I look in the data the flow takes I clearly see that it takes some unique lines and count them double.

 

I first thought is was a coincidence but it also happened in another flow also going over this list and it happens on the same records. Is there something I am not looking at?

 

 

3 REPLIES 3
NiloferA
Solution Supplier
Solution Supplier

Hello @Jdeschuymere ,

Can you post screenshot of your flow and explain how it works?

Jdeschuymere
Frequent Visitor

Hello @NiloferA 

 

Thanks for your question. Hereby some picture + more info. i will not go over the entire flow to not waste all of your time.

 

First of i create a variable to find the first day of the past month and a variable to determin the last day of that month. In the Get items from Sharepoint list i then choose my list and filter it to be >= to the startdate and <= last date of the month. This is working if i look in to the runs. I sort these results by the employee.

step1.PNG

 

After this step comes an apply to each. I look for each different employee to add that to an array and continue with that array. It is in this apply to each that i noticed i have 162 results even though in the last picture you see there are only 158 results. step2.PNGstep3.PNG excel export of the list with same filter as in the PowerAutomate.

 

Jdeschuymere_0-1623236614846.png

This is the output from my get data from Sharepoint. You can see 1 of the doubles. On on entry 96 and one on entry 103. The ItemInternalId is the same and the created date is also the same.

 

I hope this makes it a little clearer.

Hello @Jdeschuymere ,

Hmm, that's strange perhaps you can try and check what are the actual values of the variables used in the filter expression and see if you can find something fishy there, or you can try to use "Send an HTTP Request to SharePoint" action and use groupby phrase in the api call to get unique values based on ID.

NiloferA_0-1623256245784.png

_api/web/Lists/getByTitle('Your_Library_Name')/items?$groupby=ID&$select=ID,*&$filter=Your_Column_Name ge 'Your_Variable' and Your_Column_Name le 'Your_Variable'

And to count the number of rows returned by this query, you can use compose action as follows

NiloferA_2-1623256425524.png

length(outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['results'])

 

NiloferA_1-1623256354566.png

Let me know how this works out for you

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,809)