cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User III
Super User III

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
Super User III
Super User III

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

Thank you for your answer.

 

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

 

 

Hello 

 

 

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (32,870)