Create and Filter an array in 2 easy steps

Filter an array or collection in Power Automate

When you want to filter an array in a Power Automate flow, there are a couple of  challenges you might face.

A while back wrote a post about arrays in Flow. One of the things that I didn’t look at was filtering arrays. Filtering arrays is actually really simple.

Microsoft Flow has filter options available to make things easy. Before I filter an array I will first create an array.

Create an array

I started by creating an array. The array starts with [ and it ends with ] and each item inside the array starts with { and ends with }. All standard json stuff.

An Array in Power Automate

You could of course also use a compose action instead of this but it doesn’t matter too much.

You might also have an action that generates an array and you haven’t got any option to specify filters on the action and the action returns too much information.

Filter Array or Collection

Now I only want to select the items that have IsOk set to Yes. This can be done with the Filter array action.

Filter the Array in Microsoft Flow

The filter array’s condition can be set in the advanced mode to

@equals(item()?['IsOk'], 'Yes')

or you could set the left hand side of the condition to item()?[‘IsOk’] using the expression editor and then set the right hand side to Yes.

The conditions here could include any kind of query that you would also use in conditions in your flow.

8 thoughts on “Filter an array or collection in Power Automate

  1. I’m trying to pull multiple lines of data from an excel spreadsheet into a word template using MS Flow. Would an array work to pull the information.

  2. Can you please help me? I have a string in Logic Apps which is 40 chars long and I need to trucate it to 30. I don’t see a function like that and I have googled for hours. If you have any suggestions please let me know. Thanks! MIke Kiser

  3. Every day you make my day! Thank you very much for your help with Power Automate! It’s a great tool, but sometimes simple tasks become nightmares in Power Automate.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: