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 / Merge 2 array bodies i...
Power Automate
Answered

Merge 2 array bodies into single array using append to array variable in power automate

(0) ShareShare
ReportReport
Posted on by 75

Hello, 

 

I have 2 arrays resulting from 2 different 'Select' operation as below , I need to combine the output into single array for using it in looping later for each unique value in "Apply to each" step. 

 

I tried using "append to array variable ", but it does not merge the elements inside array.

Can you please let me know what I am missing here ? 

 

Sivaperumal31_1-1678326125983.png

 

Sivaperumal31_2-1678326170526.png

 

Sivaperumal31_3-1678326190105.png

 

Thank you 

 

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

    Hi @Sivaperumal31 

     

    I have made a test for your reference:

    1.

    vliweimsft_0-1678332328690.png

    2.

    vliweimsft_1-1678332403429.png

    3.

    vliweimsft_2-1678332433570.png

     

    Best Regards,

    Levi

     

     

  • Sivaperumal31 Profile Picture
    75 on at

    Thank you @v-liwei-msft , It worked , I missed "Apply to each " before . 

    I assume I have to use another "Apply for each "  if I have to combine 3rd Array ? 

    Guess no other way to combine multiple array(3 or more ) other than using "apply to each" for every array to be appended .

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    @Sivaperumal31 You can use the union expression to combine any number of arrays. Below is an example of how it works.

     

    //Will combine all arrays into a single array and remove any duplicate values
    
    union(array1, array2, array3, array...)

     

    See example below where I have three Selects similar to yours where we then use a union expression to combine them and remove any duplicate values.

    grantjenkins_5-1678366182527.png

     

    My three Selects have the following output. Note that "MY" Is listed twice so one of them will be removed when we apply the union expression.

    grantjenkins_6-1678366228108.png

    grantjenkins_2-1678366023775.png

    grantjenkins_3-1678366044845.png

     

    Compose uses the following expression to combine (union) the Selects and remove duplicate values.

    union(body('Select_1'), body('Select_2'), body('Select_3'))

    grantjenkins_7-1678366324754.png

     

    This would give the output below.

    grantjenkins_9-1678366403694.png

     

    Apply to each uses the output from Compose so it iterates over each of the items in the array.

    grantjenkins_8-1678366382912.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • Sivaperumal31 Profile Picture
    75 on at

    Thank you @grantjenkins .

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard