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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Combine elements of an...
Power Automate
Unanswered

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,474 Super User 2025 Season 2 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,436 Super User 2025 Season 2 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard