Hello - I have a filter array that is not returning any data, even though I can see that the data is clearly in the array. I must be overlooking something basic, but I'm at my wits end figuring it out.
Using the List rows present in a table action, I have a table with rows containing employee_ids with their corresponding manager_ids. Managers are also listed in the employee_ids. The flow has four small Apply to each loops. The first Apply to each is working. It takes the employee id and looksup the corresponding manager id and sets it as a variable. The flow acts as if the next three loops are also working; however, the filter array isn't returning any data when it should be.
Below is a table of how the data is designed.
The 1st Apply to Each works as expected and pulls the ID number that is associated with the Employee_PSU_ID in my table, and then sets the string variable for that as Manager1ID as below.
1st Apply to each working and sets Manager ID variable.
But when I build my 2nd Apply to Each loop using the newly set variable of Manager1ID to lookup and set a variable for that person's manager - Manager2ID, it is returning a null value.
2nd apply to each to match the Manager1ID with Employee ID in the table
Actual code of the filter array:
filter array actual code
Filter array returns no value even though the ManagerID is in the table as an Employee ID
Any help with this would be most appreciated!
Solved! Go to Solution.
@BAJ before filter array, use one compose and pass current item from dynamic content. Run your flow and show output.
Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.
I too also have this issue, not quite sure where going wrong. Mine is a little more simplified and it would be good to get an answer. I'm trying to email the users that own the record, from the items in a dataverse - List rows trigger. I don't want to send all items on the list to users which don't own the record.
1. List Rows (dataverse)
2.Initalize Variable (varEmail)
3. Apply to each > "Value" from List Rows> Append to Array Variable (varEmail) "requested by"
4.Compose> union(variables('varEmail,variables('varEmail')) # this deduplicates
5.Join> "outputs" from Compose>Join with ";" to go from array to a string
6.Apply to each filter you see below (which is failing, I want to email the user the records they own/uploaded out of the list rows in step 1.)
7.Create HTML table to email with record information
8. send email, body is the HTML table
Hi BAJ! I'm not a superuser by any means, but I think for an Apply to each, you want an array so if you are building the Apply to each from a compose that creates a string, I think that would cause an error. In your use case, I would try working off of your first compose which is a deduped array.
I hope this helps!
kky
@kky1 Because output is not matching that is why it is returning blank. Manager1Psuid output is ["9346"] & filter array value is 9346... are these two equal? NO
Make these value equals then filter arrray will return result.
Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.
@BAJ before filter array, use one compose and pass current item from dynamic content. Run your flow and show output.
Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.
Thank you Hardesh15! 100% correct! @BAJ, in case it is helpful, I added a couple more compose actions after the filter array and select actions to reformat the outputs before setting it as a variable.
So the new steps to get it to match are:
1. Filter array
2. Select action on email and ID
3. Compose: dedupe after selected email and PSUID
union(body('Select-manager1email'),body('Select-manager1email'))
union(body('Select-manager1psuid'),body('Select-manager1psuid'))
4. Compose - get first item of the array to create a string
first(outputs('dedupeMan1email'))
first(outputs('dedupeMan1PSUID'))
5. Compose - replace the " (double quotes) with '' or nothing
replace(outputs('firstMan1email'), '"','')
replace(outputs('firstMan1PSUID'), '"','')
6. Finally - set the variables for ManagerID and Manager Email on the outputs of the compose above.
After this, the variables matched. Here is a screenshot.
extra compose steps solved my issue