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

Announcements

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:
I have the same question (0)
  • Verified answer
    v-yetonggu-msft Profile Picture
    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

Forum hierarchy changes are complete!

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

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 237 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 176 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 96 Super User 2026 Season 1

Last 30 days Overall leaderboard