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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Joining 2 arrays based...
Power Automate
Answered

Joining 2 arrays based on position and not a common ID

(0) ShareShare
ReportReport
Posted on by 4

I have exhausted looking for an answer so I am going to ask.

 

I have 2 arrays and I need to join them so that I can then have my table created from a single array and send it out. Here are the arrays:

Array1

Names from a name picker

 

{
 "Resource Name": "First Last"
}

 

2nd Array has a number that is a string input on the front end form but I convert to an array so it looks like this

{
"percent": "100"
}

 

The first array might have 1 or 20 names in it and the 2nd array will have the same number of items as the first array. I need to add the 2nd array to the first as a property so that it comes out like this:

 

[
 {
 "Resource Name": "First Last",
 "Percent Allocated": "100"
 },
 {
 "Resource Name": "First Last",
 "Percent Allocated": "50"
 }
]

 

 

 

How do I merge the arrays based on position of the items, for instance the 2nd array [0] goes to the first array [0] as a property and so on throughout the total number of items?

 

Thank you in advance!

Mokono

Categories:
I have the same question (0)
  • Verified answer
    ScottShearer Profile Picture
    25,294 Most Valuable Professional on at

    @Mokono 

    Here is one solution:

    image.pngimage.pngimage.png

    The end result looks like this (partial screen shot):

    image.png

  • eliotcole Profile Picture
    4,424 Moderator on at

    Hi, @Mokono, there's quite a few answers here that might've helped you, but it can be done in a single step with a bit of creative expression writing!

     

    Range That Is The Length Of Your Array Then Pick

    So ... a quick and easy way to do this is to take the two arrays and then select them into one array, using a range() expression in its From field.

     

    In my example, below, you will see that I am referencing my two 'mock' variables, here, but yours will be different references ... just change variables('arrayOneVAR') / variables('arrayTwoVAR') to point to your arrays:

    merge-arrays-DELETABLE.jpg
    From
    range(
    	0, 
    	length(
    		variables('arrayOneVAR')
    	)
    )
    Map
    Key Value
    Resource Name
    variables('arrayOneVAR')[item()]?['Resource Name']
    Percentage
    variables('arrayTwoVAR')[item()]?['percentage']

    What this does is:

    1. Makes a range(), which is an array of numbers from the number before the comma, to the number afterwards.

      Here, that second number is the amount of items in the array containing the Resource Name items.

      This looks like this in my above example:
      [
      	0,
      	1,
      	2
      ]
    2. For each item in that range it then makes the appropriate Key/Value pairs.

      Here you are using the item() (which is simply a number) to select an entry from the previous array.

      So the first entry here is 0 that will select the Resource Name from entry 0 of arrayOneVAR:
      variables('arrayOneVAR')[item(0)]?['Resource Name']

     

    Hope this helps!

  • Mokono Profile Picture
    4 on at

    In the append to array box, what is the expression you are using to pull in each of the different array items as it is cutoff in the screenshot.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard