Skip to main content
Community site session details

Community site session details

Session Id : I+sy4HpFxloES/5UV/dgrj
Power Automate - Building Flows
Unanswered

Combine values with common ID into single value

Like (0) ShareShare
ReportReport
Posted on 21 Aug 2022 09:27:31 by 2

I have the following array:

 

[
  {
    "ID""27",
    "Value""ICT|f7df09b2-e931-4a27-a2cc-975440062d12"
  },
  {
    "ID""27",
    "Value""ICT|f7df09b2-e931-4a27-a2cc-975440062d12;Quality and Safety|90ceaeb1-7dfb-466c-a292-532e9725a6eb"
  }
]
 
I need to convert this array into a single object that I can append to another array, in the form of:
 
  {
    "ID""27",
    "Value""ICT|f7df09b2-e931-4a27-a2cc-975440062d12;ICT|f7df09b2-e931-4a27-a2cc-975440062d12;Quality and Safety|90ceaeb1-7dfb-466c-a292-532e9725a6eb"
  }
 
It doesn't matter that this contains a duplicate as Power Automate resolves this in a later step, but I do need to get all the options in a single value.
 
So far I've been mucking around with union/select/replace to try to achieve it but I'm out of my depth so would appreciate some guidance!
 
Cheers, 
 
Rob
  • Paulie78 Profile Picture
    8,416 Moderator on 21 Aug 2022 at 13:06:37
    Re: Combine values with common ID into single value

    This may work for you (if I understand correctly):

    2022-08-21_14-03-08.png

    The code on the left side of the filter array is:

    length(split(item()['Value'], '|'))

    All that is happening is any entry within the array that does not contain 3 values delimited by a pipe symbol in the value property is removed. Which leaves you with one entry in the array:

    [
     {
     "ID": "27",
     "Value": "ICT|f7df09b2-e931-4a27-a2cc-975440062d12;Quality and Safety|90ceaeb1-7dfb-466c-a292-532e9725a6eb"
     }
    ]

    The the final compose just gets the first entry in the array which is your object.

     

    Blog: tachytelic.net

    YouTube: https://www.youtube.com/c/PaulieM/videos

    If I answered your question, please accept it as a 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

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