Filter array in Power Automate

Today I’m going back to this week’s planned posts on Data Operations in Power Automate, and I’ll be showing you how to use the filter array data operation in Power Automate. What is filter array? Filter array is a data operation that will allow… READ MORE [https://lewisdoes.dev/blog/filter-array
person holding magnifying glass
Photo by Maurício Mascaro on Pexels.com
In: Low Code Lewis Content 🚀

Today I’m going back to this week’s planned posts on Data Operations in Power Automate, and I’ll be showing you how to use the filter array data operation in Power Automate.

What is filter array?

Filter array is a data operation that will allow us to take an array and reduce its records/items, based on criteria we supply it with.

For example, I might have an array with a number of objects in it, and now I only want the objects with a status of ‘New’. We can achieve this by using a filter array action.

Filtering outputs from a SharePoint list using filter array

So, as an example, I’m going to take some outputs from a list items I’m executing on a SharePoint list with a number of items in it, and I’m going to filter the outputs.

You can see I have a few columns in my SharePoint list, one of which is a choice with a few values in it. My aim is to filter the array I’m going to get from my get items which based on my criteria on my get items will be all of the records in the list, and I’m then going to filter that using the filter array data operation action.

So I’ve got my manual trigger which is what I’m needing in this example, I’m then using a get items to get my list items from SharePoint, now I’m going to add a filter array action afterwards to filter the array I’ll get within the value of the outputs SharePoint gives back to me.

In my filter array, for the from field, this is where I’m passing in the array that I want to filter. So here I’m going to use the value dynamic content from my list rows which will be an array of objects which are the records in my SharePoint list.

Now my filter array will identify dynamic content based on the fields in the objects in my array, so I can use them to do a comparison to create my filter.

I’ll choose one of the columns in my dynamic content as the value in the left hand box to the comparison selector.

Then I’ll select a comparison I want to use against the value I’m going to compare against in the right hand box. Attempting to achieve my goal, I’m going to use ‘is equal to’ and ‘New’ in the right hand value input.

Now if I save my flow and give it a test, I can see that in my filter array action, I’m getting the same array from the value of my get items, but only with the objects where my Status value is equal to “New”!

Super simple!

I hope you found this post helpful. If you didn’t understand something, let me know and I’ll be happy to help 🙂

Written by
Lewis Baybutt
Microsoft Business Applications MVP • Power Platform Consultant • Blogger • Community Contributor • #CommunityRocks • #SharingIsCaring
Comments
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to LewisDoesDev.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.