I am so close to a solution but not sure why my flow is behaving as it is.
Purpose: To allow people to select what new items in a SharePoint library they are notified about based on columns associated with the documents.
Basic logic:
Once a week
Get new items from the document library
Store in Array1
Get items from a table where users have selected their choices (7 different columns of choices)
Store in Array2
Loop through each row in Array2
Clear TableArrays for each Array2 element
For each column of choices (array2 element) loop through choices selected
Loop through Array1
Append any records where the choices match to TableArray
Append all TableArrays together
Remove duplicate records
Email person with their table of choices
Next loop
The problem I am having is that after the first run, the TableArray doesn't seem to clear for the second run. Each user is getting the first table built, instead of something bespoke. No errors, except that I do get an error on the run report when I try to see the results of the second loop of Array 2 (Unexpected error. Unable to fetch https://.......), which is making it impossible to see what the arrays are reading and the csv is difficult to work out the loops.
The input and output of the steps to clear the TableArrays seem to suggest the input array is already blank but it still spits out the first loop table for every loop.
Here is the flow with some annotation:
Inside Apply to each:
Each Scope includes the following pattern:
Final part of flow:
No doubt there is a more efficient way to do things (I did have the scopes all running in parallel but tried putting in sequence to see if that made a difference - it didn't) but the main question for me is why is it maintaining the same table for every loop? And yes, I have checked that they should be different!
Any suggestions welcome.
User | Count |
---|---|
93 | |
39 | |
24 | |
20 | |
16 |
User | Count |
---|---|
129 | |
49 | |
48 | |
30 | |
25 |