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 / Combine elements of an...
Power Automate
Answered

Combine elements of an array with a field in common

(0) ShareShare
ReportReport
Posted on by 6
Hello everyone,
 
I have following array (they are basically elements of a list in share point) in which some elements have the same "Revision":
 
{
  "Revision": 123,
  "Comment": first comment
},
{
  
  "Revision": 123,
  "Comment": second comment
},
{
  
  "Revision": 456,
  "Comment": first comment
},
{
  
  "Revision": 789,
  "Comment": first comment
}...
and so on.
 
Is it possible to combine all the elements having the same "Revision" by merging the comments? The deisred output, considering that two element feature the revision "123" would be:
 
{
  
  "Revision": 123,
  "Comment": first comment second comment
},
{
  
  "Revision": 456,
  "Comment": first comment
},
{
  
  "Revision": 789,
  "Comment": first comment
}
 
Thanks in advance
Categories:
I have the same question (0)
  • lbendlin Profile Picture
    8,661 Super User 2026 Season 1 on at
    I am sure there are more elegant ways
     
     
     
    1. Select unique Revisions
     
     
    2. For each revision find and join all comments
     
     
    3. Stuff the results into the output array
     
     
  • FP-22010922-0 Profile Picture
    6 on at
    Hello lbendlin,
     
    thank you very much for your answer, however I am not able to reproduce your example, because some parts of the flow are missing in your screenshot  (such as "Filter array").
    Would you please be so kind to upload the flow?
     
    Thanks you
  • Verified answer
    Chriddle Profile Picture
    8,685 Super User 2026 Season 1 on at
    From
    union(
    	xpath(
    		xml(json(concat('{"Root":{"Item":', outputs('Compose'), '}}'))),
    		'//Revision/text()'
    	),
    	json('[]')
    )
    Revision
    item()
    Comment
    join(
    	xpath(
    		xml(json(concat('{"Root":{"Item":', outputs('Compose'), '}}'))),
    		concat('//Item[Revision="', item(), '"]/Comment/text()')
    	),
    	' '
    )
     
  • FP-22010922-0 Profile Picture
    6 on at
    @Chriddle thank you very much for your proposed solution!!

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 552

#2
Valantis Profile Picture

Valantis 388

#3
11manish Profile Picture

11manish 375

Last 30 days Overall leaderboard