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 / Remove an element from...
Power Automate
Unanswered

Remove an element from an array in flow

(1) ShareShare
ReportReport
Posted on by 42

Hello


I have an array that looks like this called array 1

 

[
 {
 "claims":"user1"
 },

 {
 "claims":"user2"
 },
 
 {
 "claims":"user3"
 }
]

 

I have a separate array variable called array 2 with the following 

 

[
 {
 "claims":"user2"
 }
]

I would like to compare the array 2 with array 1 to see if 'user 2' is in that array 1, if they are, I would like to remove them from that array 

 

Thanks for your help!

Categories:
I have the same question (0)
  • RezaDorrani Profile Picture
    12,145 on at

    Hi @surfer1978 

     

    Intersection function between the 2 arrays will give you results if there is  match

    so do intersection of both arrays and then check length of output

    if length is 1 - then item exists in array

     

    Next for removing item

    Use filter action on array 1 (whih is your main array)

     

    and filter if 

    item()?['claims'] 

    is not equals to

    dynamiccontentarray2?[0]?['claims'] 

     

    Regards,

    Reza Dorrani

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    @surfer1978 

    Hi there!  Will Array 2 only ever have one value?  If so, I wonder if you could set it to a string, then do a step to build a new Array (1A?) with each line that does not equal the string in #2?

    I think leaving #2 as an array will get weird because of the many to many potential...that's why I asked.

     

    Keep us posted.

    -Ed-

     

     

    If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

  • SrivHari Profile Picture
    Microsoft Employee on at

    In the same example provided I just want to remove "Claims" keyword or element in the output.. what should be done for that ?

  • dee2005 Profile Picture
    95 on at

    @edgonzales , how would you build the new array to exclude the text?

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    Hi there.  Same as @RezaDorrani .  To exclude the "Claims" bit, in whatever step you're using the dynamic value, just grab the value rather than the whole element of the array.  Parse JSON might make that easier.

  • Paulie78 Profile Picture
    8,422 Moderator on at

    @dee2005 this is an approach you could use to remove the unwanted value and remove the claims property at the same time. To my mind, there is no point checking if the value exists and then remove it. That is two actions when one will do. Just remove it, if it does not exist it wont do anything.

    https://ibb.co/1nTKdyY

    removeElement.png

    Result is a plain array with just these results:

    removeElementResults.png

    This example is only any good if your array2 only ever contains a single element.

     

  • dee2005 Profile Picture
    95 on at

    Thanks @Paulie78 I guess I dont need a second array? I can just pass the text I want to remove in the filter array condition?

  • Paulie78 Profile Picture
    8,422 Moderator on at

    @dee2005 correct

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 251 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 239

#3
Expiscornovus Profile Picture

Expiscornovus 220 Most Valuable Professional

Last 30 days Overall leaderboard