cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Merging arrays into one

Hello,

 

I have two parallel Azure AD Get group users actions and I want to merge the result into one so I can then apply a for each to the combined array

 

How can I do that? Thanks

2 REPLIES 2
Highlighted

Re: Merging arrays into one

You might have to step through one array using the apply and then use array.add expression to add each item of the second array to the first array

Highlighted
Community Support
Community Support

Re: Merging arrays into one

Hi @ christian-aid,

 

I have made a test on my side, you could refer to steps below to create the flow:

  1. Add a trigger, here I use the “Manually trigger a flow”.
  2. Add an “Initialize variable”, name the variable as “group users”, the type choose “Array”, leave the “Value” field blank.
  3. Add action “Get group members”, fill in the first Group Id in the input field.
  4. Add an “Apply to each” under the “Get group members”, choose the “Group Members” dynamic content of the “Get group members” in the input field.
  5. Add an “Append to array variable” inside the “Apply to each”, choose the “group users” in the Name field, choose the “Current item” dynamic content of the “Apply to each” in the “Value” field.
  6. Add a parallel branch under the “Initialize variable”, add a “Get group members 2”, “Apply to each 2”, “Append to array variable 2” as step3,4,5.
  7. Add a Compose under the “Apply to each” and “Apply to each 2”, the expression of the Compose as below:

union(variables('group users'),variables('group users'))

Note:This step is to return only one element if there are the same elements in the array.

     8. Add an “Apply to each 3” under the “Compose”, choose the “output ” dynamic content of the Compose in the input field.

     9. You could add a “Compose 2” inside the “Apply to each 3”,choose the “Current item” dynamic content of the “Apply to each 3” in the input field to get every member’s information.

 

 11.png

 

The flow would run successfully as below:

 12.png

 

 

 

Regards,
Alice Zhang

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,861)