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

Community site session details

Session Id : UAOXXcUkxkBnBa2a93giy6
Power Automate - General Discussion
Unanswered

Joining/Merging Arrays

Like (0) ShareShare
ReportReport
Posted on 26 May 2024 13:08:15 by 55

Hello!

I have two SharePoints that I am trying to Join/Merge in PowerAutomate: SP1 1 with the full list of vehicles & SP 2 with inspection times. Both share the same data in "Title." The inspections SP has a column called "Time"

 

Currently I have:

Get Items (gets items from SP1)

Get Items 2 (gets items from SP2)

Select (called Select-Inspection-Times)

  • From = 

 

Outputs('Get_Items_2')?['body/value']​

 

  • Map = 

 

concat('"',item()?['Title'],'":',item())​

 

Compose

  • Inputs = 

 

json(concat('{',join(body('Select-Inspection-Times'),','),'}'))​

 

Select

  • From = 

 

Outputs('Get_Items')?['body/value']​

 

  • Map =
    • Vehicle = 

 

item()?['Title']​

 

  • Inspection Time = 

 

outputs('Compose')?[string(item()?['Title'])]?['Time']​

 

Currently, I am getting the correct data, but only the first iteration. So if I have in SP1:

  • A
  • B
  • C

and in SP 2:

  • A - 9:00
  • A - 10:00
  • B - 8:00

When I run the flow I get:

 

[
 {
 "Vehicle": "A",
 "Inspection Time": "9:00"
 },
 {
 "Vehicle": "B",
 "Inspection Time": "8:00"
 },
 {
 "Vehicle": "C",
 "Inspection Time": null
 }
] 

 

I am hoping to be able to get something that looks like: 

 

[
 {
 "Vehicle": "A",
 "Inspection Time": "9:00, 10:00"
 },
 {
 "Vehicle": "B",
 "Inspection Time": "8:00"
 },
 {
 "Vehicle": "C",
 "Inspection Time": null
 }
] 

 

Any suggestions on what I need to do to get there? I feel like I'm close, but I can't get it to run with more than 1 iteration of each. 

Thanks!

  • Nived_Nambiar Profile Picture
    17,954 Super User 2025 Season 2 on 26 May 2024 at 18:58:04
    Re: Joining/Merging Arrays

    Hi @dsopshin 

     

    Your current code seems to taking first Inspection time entry, let's make the flow design little bit simpler

     

    Consider this is the vehicle list

    Nived_Nambiar_0-1716749270846.png

     

    Consider this as inspection list

    Nived_Nambiar_1-1716749309925.png

     

     

    Now let's go to flow design

     

    1. Get items from vehicle list

    Nived_Nambiar_2-1716749349688.png

     

    2. Select only Title column from the vehicle list using select action

    Nived_Nambiar_3-1716749417823.png

     

    3. get items from Inspection list

    Nived_Nambiar_4-1716749443288.png

     

    4. Select the title and Inspection Time column values from output of Get items of Inspection List

    Nived_Nambiar_5-1716749509028.png

     

    5. Use compose action to create an array structure like below

    Nived_Nambiar_6-1716749550068.png

     

     

    6. use select action to map each vehicle to its inspection timings (as required per output)

    Nived_Nambiar_7-1716749626466.png

     

    Nived_Nambiar_8-1716749645497.png

     

    Nived_Nambiar_11-1716749823988.png

     

     

    Expression - 

    if(empty(join(xpath(xml(outputs('Compose')),concat('//data[Title="',item(),'"]/InspectionTime/text()')),',')),null,join(xpath(xml(outputs('Compose')),concat('//data[Title="',item(),'"]/InspectionTime/text()')),','))
     
    Now see the result-
     

    Nived_Nambiar_12-1716749876326.png

     

     

    Hope it helps !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete