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

How to combine two array variables into 2D Array

Hello,

 

I have not found anything similar to this. I am trying to combine two array variables into one 2D array, like the following.

 

Instead of coming out like this:

 

Col1      Col 2

X

X

X

               X

               X

               X

 

I want to combine my columns to come out like this

 

Col1      Col 2

X           X

X            X

X            X

 

 

 

Is there a way to do this?

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @leighp ,

 

If the two arrays do not have a one-to-one corresponding unique identifier column but the array lengths are the same. Maybe you could try as follows: 

items('Apply_to_each')?['Col1'] 
variables('vararray2')[variables('varindex')]?['Col2'] 
{ 
  "Col1": @{items('Apply_to_each')?['Col1']}, 
  "Col2": @{variables('vararray2')[variables('varindex')]?['Col2']} 
} 

vyujincuimsft_0-1661500537731.png

vyujincuimsft_1-1661500537734.png

vyujincuimsft_2-1661500537735.png

Result Screenshot: 

vyujincuimsft_3-1661500537737.png

 

 

Best Regards, 
Charlie Choi
 

View solution in original post

1 REPLY 1
v-yujincui-msft
Community Support
Community Support

Hi @leighp ,

 

If the two arrays do not have a one-to-one corresponding unique identifier column but the array lengths are the same. Maybe you could try as follows: 

items('Apply_to_each')?['Col1'] 
variables('vararray2')[variables('varindex')]?['Col2'] 
{ 
  "Col1": @{items('Apply_to_each')?['Col1']}, 
  "Col2": @{variables('vararray2')[variables('varindex')]?['Col2']} 
} 

vyujincuimsft_0-1661500537731.png

vyujincuimsft_1-1661500537734.png

vyujincuimsft_2-1661500537735.png

Result Screenshot: 

vyujincuimsft_3-1661500537737.png

 

 

Best Regards, 
Charlie Choi
 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,605)