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

Loop through the list

Hi,

 

I have a requirement to loop through my SharePoint list and find out how many records have a field set to certain value. 

 

For example, if my list is a list of all the employees who are coming to a company event in person or logging in remote. I have to run a flow to capture some data points like 

 

Logging in remote: 320

In Person: 24

IT Attendee's:  185 people

HR Attendee's: 35 People

 

How can I achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Loop through the list

Hi!

So your flow shall be executed on a specific schedule (once a day, or once a week, or...) right?

If so, I believe you need a 'schedule' trigger and a 'get items' action block to read all your SP list items.

Now, if you always need to report the counters, and the status values are always the same i.e. 'Logging in remote', 'In person', 'IR attendees', 'HR attendees', I would recommend one 'Filter array' action block per status value. You can add the status value to 'Filter array's' name:

Filter array Logging in remote

Filter array In person

...

Assign as 'Filter Array' input your 'Get items' output, and implement a Condition rule to evaluate if Sharepoint column Status takes a specific value. Since you have 4 status to report, you need 4 'Filter arrays'

Finally, you can use a WDL expression to calculate nr of items included in 'Filter array' output:

length(body('Filter_array_Logging_in_remote'))

length(body('Filter_array_In_person'))

...

 

If you are not familiar with WDL expressions please follow these steps to add them

https://youtu.be/LPZ-WZoWwp4

 

Please note if you plan to change, add or removee your Status value list, you will need to update your Flow, or, build dynamically a Dictionary with all stored values and iterate through them with an 'Apply to each'

Hope this makes sense

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

3 REPLIES 3
Highlighted
Dual Super User III
Dual Super User III

Re: Loop through the list

Hi!

So your flow shall be executed on a specific schedule (once a day, or once a week, or...) right?

If so, I believe you need a 'schedule' trigger and a 'get items' action block to read all your SP list items.

Now, if you always need to report the counters, and the status values are always the same i.e. 'Logging in remote', 'In person', 'IR attendees', 'HR attendees', I would recommend one 'Filter array' action block per status value. You can add the status value to 'Filter array's' name:

Filter array Logging in remote

Filter array In person

...

Assign as 'Filter Array' input your 'Get items' output, and implement a Condition rule to evaluate if Sharepoint column Status takes a specific value. Since you have 4 status to report, you need 4 'Filter arrays'

Finally, you can use a WDL expression to calculate nr of items included in 'Filter array' output:

length(body('Filter_array_Logging_in_remote'))

length(body('Filter_array_In_person'))

...

 

If you are not familiar with WDL expressions please follow these steps to add them

https://youtu.be/LPZ-WZoWwp4

 

Please note if you plan to change, add or removee your Status value list, you will need to update your Flow, or, build dynamically a Dictionary with all stored values and iterate through them with an 'Apply to each'

Hope this makes sense

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Highlighted
Helper II
Helper II

Re: Loop through the list

Thank you for your answer.

 

It sounds right. I will try and let you know.

 

 

Highlighted
Helper II
Helper II

Re: Loop through the list

Hello 

 

 

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (4,264)