web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Comparing multidimensi...
Power Automate
Unanswered

Comparing multidimensional arrays without nested 'apply to each' actions

(0) ShareShare
ReportReport
Posted on by 2

Hey all! I'm looking for a more efficient way to compare two multidimensional arrays in a flow. In my current flow/logicapp I'm doing an 'apply to each' on Array1, nesting an 'apply to each' within on Array2. Below are the two example arrays:

 

// Array1
[
 {
 "Color":"Yellow",
 "ID":"1"
 },
 {
 "Color":"Blue",
 "ID":"2"
 },
 {
 "Color":"Green",
 "ID":"3"
 }
]

// Array2
[
 {
 "Category":"Animal",
 "MyID":"1"
 },
 {
 "Color":"Automobile",
 "MyID":"2"
 },
 {
 "Color":"Building",
 "MyID":"3"
 }
]

 

I'm looking for the action or that would match these arrays on ID and MyID, appending the value pairs in each to a final array (Array3). The final array should look like the below.

 

// Array3
[
 {
 "Color":"Yellow",
 "ID":"1",
 "Category":"Animal",
 "MyID":"1"
 },
 {
 "Color":"Blue",
 "ID":"2",
 "Color":"Automobile",
 "MyID":"2"
 },
 {
 "Color":"Green",
 "ID":"3",
 "Color":"Building",
 "MyID":"3"
 }
]

 

Though my current method of embedded 'apply to each' works...it is pretty inefficient. I'm thinking there has to be a better way to match up this data with one another. Possibly using union [documentation]?

Categories:
I have the same question (0)
  • Verified answer
    v-bacao-msft Profile Picture
    on at

     

    Hi @gigmog ,

     

    You could refer to the following methods to create Flow.

    It seems that there is something wrong with the properties you filled in the array. It seems that color should be Category. If it is color, this is not reasonable.

    I changed it to category and then configured the following Flow to integrate the two arrays.

     

    Use the Parse JSON action to parse the properties in the array. Then define a third array variable to integrate the array.

    http://johnliu.net/blog/2018/6/a-thesis-on-the-parse-json-action-in-microsoft-flow

     

    Iterate through the first array to determine whether the ID is equal to MyID, and if so, append data to the third array.

     

    You could directly import the .zip file in the attachment to view the configuration of Flow.

    Hope this helps.

     

    Best Regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard