Skip to main content

Notifications

Community site session details

Community site session details

Session Id : kEfCNvfFKpik6JxG+LJWoh
Power Automate - Building Flows
Answered

Removing Array Duplicates

Like (0) ShareShare
ReportReport
Posted on 18 Sep 2020 11:31:26 by

I have a Flow that sends an Email to people in a contact list, but I sometimes get duplicate values in my array.

 

I dont want to send multiple messages to the same Email, so i need to remove the duplicated values.

 

Any idea how can i do that? 

  • Casper Profile Picture
    41 on 15 May 2024 at 14:32:02
    Re: Removing Array Duplicates

    This is a great post and helped a lot thank you.  I want to add on that question.

    My scenario is this.  I have to Tables (Arrays) I want to compare. 

     

    But first I need to filter the Table BC to only have distinct Account numbers, the catch is I want the Account number (in this case CPA004) to retain the entry with the highest last entry number (4002), and discard the other CPA004 entries.

     

    Decsus_0-1715783302380.png

     

  • ManiLive Profile Picture
    41 on 30 Mar 2021 at 16:28:12
    Re: Removing Array Duplicates

    A faster way to remove duplicates is to union the input array with an empty array.  This saves a lot of time with larger sets.
    Initialize an empty array using Compose and use another Compose to union the input array with the empty array.

    Union with empty array to get unique values.Union with empty array to get unique values.

     

  • Community Power Platform Member Profile Picture
    on 21 Sep 2020 at 06:55:43
    Re: Removing Array Duplicates

    Thabnk you very much, this was very usefull!

  • Community Power Platform Member Profile Picture
    on 21 Sep 2020 at 06:54:55
    Re: Removing Array Duplicates

    Thank you very much for the detailed explanation.

     

    This worked as expected.

  • Verified answer
    yashkamdar Profile Picture
    1,044 on 18 Sep 2020 at 12:23:40
    Re: Removing Array Duplicates

    Hello Team,

     

    This is extremely easy to implement, let me guide you.

     

    First see my outputs and final results-

     

    I had an array that had values 1,2,2,3,2 and needed to remove duplicates.


    I used the Union() expression and got the final result 1,2,3.

     

    yashkamdar_0-1600431298250.png

     

    How to do this, first load your array outputs in COMPOSE. My Array outputs are currently residing in array variable called ARRAY

     

    yashkamdar_1-1600431377021.png

     

     

    Then Create another COMPOSE and use the following expression -

     

     

    union(outputs('Compose'),variables('Array')) 

     

     

    Here COMPOSE is the action where the Array was loaded and Array is the name of the Array variable. Please refer the 1st compose action we create you will understand it.

     

    This is all you need to do.

     

    Once this is done, create another COMPOSE and load the outputs of Compose created earlier (the one where we put the expression) to get unique values returned.

     

     

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

  • Verified answer
    efialttes Profile Picture
    14,756 on 18 Sep 2020 at 11:54:22
    Re: Removing Array Duplicates

    @Anonymous 

    Let's assume you have your array stored in a variable called 'myArray'. In order to remove duplicates all you need to do is to create a 'Compose' action block, and assign it the following WDL expression

     

    union(variables('myArray'),variables('myArray'))

     

    You can also assign the expression to a new variable, if you prefer it instead of the Compose approach

    Suerte!

  • efialttes Profile Picture
    14,756 on 18 Sep 2020 at 11:51:29
    Re: Removing Array Duplicates

    Hi!

    I would suggest to use union() WDL function

    Give me some minutes to write a clear example

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 97

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 70 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard