cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Filter 2D Array

Hi, 

 

Is it possible to filter a 2D array using the "Filter Array" action?

 

I have an array, please see below.

 

[
  {
    "IDNumber": "1",
    "FullName": "Debbie Lob",
    "Department": "Finance",
    "Email": "debbie.lob@example.com"
  },
  {
    "IDNumber": "2",
    "FullName": "John Mills",
    "Department": "Finance",
    "Email": "john.mills@example.com"
  },
  {
    "IDNumber": "3",
    "FullName": "Mary David",
    "Department": "IT",
    "Email": "mary.david@example.com"
  }
]

How can I filter these data? Sample, I would like to get the "FullName" with "IDNumber" equals to "1"? The output should be "Debbie Lob"

These data are stored in an array variable named "NamesArray".

 

Thanks,

Chng

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper IV
Helper IV

Re: Filter 2D Array

Hi @ching29,

 

I have a way to get the value you want. 

Use Apply_to_each to iterate over the array and then use to get the properties inside each object. 

Initialize two variables, an array, and a value that holds the output.

82.PNG

 

 

Traverse the array, get the element with the IDNumber equal to 1, and then take the desired value. Then store it in the String variable and finally output it. 

The red part is Expression, not directly populated in the field.Smiley Happy

83.PNG84.PNG

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Filter 2D Array

Hi @ching29,

 

Please check the following doc on Filter array action for a reference:

https://docs.microsoft.com/en-us/flow/data-operations

Besides, hope the following blogs could be helpful:

http://johnliu.net/blog/2018/6/do-group-by-in-flow-with-two-simple-elegant-loops

http://johnliu.net/blog/2018/6/do-bulk-insertupdate-in-microsoft-flow-with-two-simple-elegant-filter...

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper IV
Helper IV

Re: Filter 2D Array

Hi @ching29,

 

I have a way to get the value you want. 

Use Apply_to_each to iterate over the array and then use to get the properties inside each object. 

Initialize two variables, an array, and a value that holds the output.

82.PNG

 

 

Traverse the array, get the element with the IDNumber equal to 1, and then take the desired value. Then store it in the String variable and finally output it. 

The red part is Expression, not directly populated in the field.Smiley Happy

83.PNG84.PNG

View solution in original post

Helpful resources

Announcements
secondImage

August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (3,339)