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?
Solved! Go to Solution.
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
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
Proud to be a Flownaut!
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
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
Proud to be a Flownaut!
Thank you for your answer.
It sounds right. I will try and let you know.
Hello efialttes,
I got a chance to test your solution today and it worked. ๐
Thank you so much for your help!
Join digitally, March 2โ4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
User | Count |
---|---|
31 | |
15 | |
13 | |
12 | |
6 |
User | Count |
---|---|
40 | |
29 | |
21 | |
11 | |
10 |