Filter The Array/Collections Using Power Automate Or LogicApps

, November 7, 2023 528 Views

Can we filter the array/collections using Power Automate or LogicApps?

Ever came across a situation where from a list of records/objects, you only want to get few based on some criteria in Power Automate Flow?  Most of us have gone through that but with the loop approach. In this blog, we will talk about the efficient way to filter the records without loop.

To filter the data from the collection, one way is to loop through the collection and use the “If” to check the condition and get the required data. But what if you have more records in the collection and looping through each is very time-consuming. Right?

Let’s explore other way to do the same thing:

  • To perform this, there is a Data Operation named “Filter Array”, specifically to filter an array of records based on a condition. You can also filter based on multiple conditions using the advanced mode editor.
  • The “Filter Array” is a type of data operation which performs operation on the entire array or collection collectively.
  • The advantage of the Filter Array is that it can perform the operation on the entire array as compared to the loops which go through every element to check the filter criteria.
  • Below is the example depicting the use of “Filter Array” in power automated flow.

We have created a manually triggered flow and an array.

filter the array/collection using power automate or logicapps

  • Then add the “Filter Array” step to the flow and add a condition to get all the details of the people whose “Gender” is “Male”.
  • To add the condition, add the Array in the From field and then add an expression to check the gender.

filter the array/collection using power automate or logicapps

filter the array/collection using power automate or logicapps

Below is the output of the above filter criteria.

filter the array/collection using power automate or logicapps

In the “Filter Array”, to add multiple conditions, navigate to the advance editor.

filter the array/collection using power automate or logicapps

An expression related to gender will be displayed.

filter the array/collection using power automate or logicapps

Now, you can add new condition by using the Operators “AND”, “OR”.

We will be using the AND operation to get all the records from the array whose “Gender” is “Male”, and whose “Age” is greater than “20”.

Below is the output of the above condition.

  • Therefore, the “Filter Array” can be very helpful in “PowerAutomate/LogicApps” when you want to filter certain items from the array based on the conditions.

With this approach, without loop control we can get the required results using one single step which saves the time the Flow takes.

Also, when connecting to any backend like Dataverse, instead of multiple Fetch on the same Table based on condition, we can use just one fetch, get all data and then use the Filter data operation to only get the required results.

So this is how we can Filter the array/collection using Power Automate or LogicApps. Hope this helps!

ATM Inspection PowerApp to ease ATM inspection and report generation process.

Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.

Comply your Lead, Contact, and User entities of D365 CRM with GDPR compliance using the GDPR add-on.

Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.



INKEY is your solution partner.
Our focus is to deliver you in-time intelligent innovative solutions ("key") for the problems in hand. Maintaining a quality standard right from the inception of a project is our top most priority.

Our team of talented professionals will execute your projects with dedication and excellence. We take ownership and accountability for the effort that goes into meeting our client’s needs.

Years of experience and proven success of delivering innovative custom solutions.

More posts by

Leave a Reply

Your email address will not be published. Required fields are marked *

The maximum upload file size: 2 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Drop file here

Would you like to digitize your business and put it on the cloud?
Do you need clear, concise reports for your organization?