cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kky1
Advocate II
Advocate II

Filter Array - no results

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. Table.JPG

 

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.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 table2nd apply to each to match the Manager1ID with Employee ID in the table

 

Actual code of the filter array:

filter array actual codefilter array actual code

 

Filter array returns no value even though the ManagerID is in the table as an Employee IDFilter array returns no value even though the ManagerID is in the table as an Employee ID

 

Any help with this would be most appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions

@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.

@Hardesh /Gopenly.in

View solution in original post

5 REPLIES 5
BAJ
Helper I
Helper I

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

BAJ_0-1659559934021.png

 

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

Hardesh15
Super User
Super User

@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.

@Hardesh /Gopenly.in

@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.

@Hardesh /Gopenly.in

kky1
Advocate II
Advocate II

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 issueextra compose steps solved my issue

 

 

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,300)