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 / Consolidate String or ...
Power Automate
Answered

Consolidate String or Array Value

(0) ShareShare
ReportReport
Posted on by 45

Have a got list of string "ABC,ABC,XYZ,DEF,ABC,DEF". Is there a way to consolidate the common string values and output as one? Hence output "ABC,XYZ,DEF,".

 

Same for arrarys. Is there a way to consolidate the common values?

["ABC,ABC,XYZ,DEF,ABC,DEF"]

Categories:
  • Verified answer
    v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @MoshinK786 ,

    If you want to merge similar terms in a string, take a look at this test.

    vyetonggumsft_3-1712466642139.png

    I use the replace function to replace the " symbol with empty, then use the split function to separate the strings with commas and turn them into an array, then use the union function to merge the same kind of items in the array, and finally use the join function to convert the merged array into a string.

     

    join(union(split(replace(outputs('Compose'),'"',''),','),split(replace(outputs('Compose'),'"',''),',')),',')

     

    The Result:

    vyetonggumsft_2-1712466537918.png

    If you want to merge similar terms in an array, take a look at this test.

    vyetonggumsft_5-1712467195599.png

     

    split(replace(replace(string(outputs('Compose')),'["',''),'"]',''),',')
    union(outputs('Compose_2'),outputs('Compose_2'))

     

    I use the string function to cast the array to a string(since the replace function can only be used in strings, I convert the array to a string in advance and use the replace function) ,then use the replace function to replace the "[and"] with empty, and then use the split function to convert the strings ABC, ABC, XYZ, DEF, ABC, DEF and DEF to a comma-separated array.

    vyetonggumsft_9-1712467507282.png

    Finally, use the union function to merge similar items in the array.

    The Result:

    vyetonggumsft_4-1712467123307.png

    Best Regards,

    Sunshine Gu

  • Kaif_Siddique Profile Picture
    2,108 Super User 2024 Season 1 on at

    Let me know if this works for you.

     

    Kaif_Siddique_0-1712486890224.png

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 302 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 130

Last 30 days Overall leaderboard