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 / Looking for a way to r...
Power Automate
Answered

Looking for a way to remove values from an array.

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am looking for a way to remove any non 10-digit values from an array.  In  this example I was to remove the 123@domain.com value but keep the 5551112222 values.

 

Here is the array:

ShawnD_0-1674669939417.png

 

Categories:
I have the same question (0)
  • Ventit Profile Picture
    422 on at

    What is the previous and What is your next step?  I assume you want to use the array values in something that would likely put it in a apply to each.  If so the field can be be set to null to remove teh email.

     

     

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    When you say you want to remove the value - do you want to just remove the value from that particular object, or remove the entire object if it contains non-10-digit values?

     

    If you meant filter the array so only objects that contain a 10-digit value would remain, then you could do something similar to below.

     

    Compose contains your array of objects.

    grantjenkins_0-1674732063668.png

     

    Filter array uses the output from the Compose and applies the following filter.

    //Checks that the length of value is equal to 10, and
    //Checks that value is a valid float (number)
    
    @and(
     equals(length(string(item()?['value'])), 10),
     equals(isFloat(item()?['value']), true)
    )

    grantjenkins_1-1674732170739.png

     

    After running the flow, we would have the following output (excludes the object with invalid value).

    [
     {
     "waitTime": 0,
     "status": "A",
     "pathId": 2419001148045324,
     "countryCode": "US",
     "value": "5551112222",
     "skipValidation": false,
     "pathEnable": true
     },
     {
     "waitTime": 0,
     "status": "A",
     "pathId": 2419001148045319,
     "countryCode": "US",
     "value": "5551112222",
     "skipValidation": false,
     "pathEnable": true
     }
    ]


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you.  I did find the use case where the 123@domain.com was the only result and was filtered out causing the flow to think it was an error.  To me this is fine but what is the best way to handle?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you.  I did find the use case where the 123@domain.com was the only result and was filtered out causing the flow to think it was an error.  To me this is fine but what is the best way to handle?

  • grantjenkins Profile Picture
    11,063 Moderator on at

    If you ended up with no results after the filter, you could check the length of the Filter array and only continue if the length was greater than zero.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello,  

     

    Thank you for your repsonce.  Would you be able to provide me an example of how to check for the length was greater then zero please?

  • grantjenkins Profile Picture
    11,063 Moderator on at

    You can use the following expression to get the length of items from an array (including Filter array).

    length(body('Filter_array'))

     

    In the example below, if you only wanted to do something if the array contained at least one item (length is greater than zero) you would put all your actions within the Yes branch.

     

    grantjenkins_0-1675469607829.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

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
Haque Profile Picture

Haque 523

#2
Valantis Profile Picture

Valantis 318

#3
David_MA Profile Picture

David_MA 235 Super User 2026 Season 1

Last 30 days Overall leaderboard