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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Filter Array working o...
Power Automate
Unanswered

Filter Array working on IDs

(1) ShareShare
ReportReport
Posted on by 10

Hello,

as I was rightfully suggested here, I implemented array filtering steps into my flows. I have got really good results for the most part, when managing string arrays, but I do need to compare integers (IDs).

Basically I need to get "Products" from a SP List, filter them only to contain the ones for which "Code" is listed in an Excel file (and create records for possible new entries) an this all works flawlessly.

Now, I get the updated "Products" list, filter it again on the Excel file (this I do to have all the data also from the possible new records added before). From this new Array I want to:

  • Filter a Mapping table (ProductID to DocumentID) and get the Products for which a relationship not yet exists: I am able to do that only by comparing strings but this allows me to create, if needed, the new relatioships in the Mapping table
  • Filter the Mapping table to get the Relationships records that are no longer required (products may have been removed from the Excel file) so I'd like to delete those relationships: I cannot make this part work neither filtering on numbers nor strings.

I must be making some systematic error but I really don't get it.

I could really much use even  only a hint in the right direction to solve this problem.

 

Here an overview of a part of the flow:

CrimellaD_1-1707680260471.png

Thanks

 

Categories:
I have the same question (0)
  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

     You might find this YT Tutorial helpful: Are you using the Microsoft Power Automate Filter Array Action wrong?

     

    I cover a similar scenario in the first section of the tutorial. For more troubleshooting tips—check out this tutorial: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows

     

    In this video tutorial I’ll show you 3 practical ways to use the Filter Array action and how to use it properly.

    1️⃣ Cross-Referencing Data

    2️⃣ Filtering by Key

    3️⃣ Substring Matching

     

    Did you know that the Condition action has a limit of 10 conditions? Although it might look like the Filter Array action can only accept one condition—this is not true. By using the advanced mode you can enter multiple conditions into a Filter Array action with an expression.

     

    IN THIS VIDEO:

     3 Ways to Use the Filter Array Action

    How to use the Scope Action to Group Actions

    How to Check the Number of Items returned from a Filter Array Action

    How to Cross-Reference Data in Excel with a SharePoint List

     How the Filter Array Action Works

     How to Access the Dynamic Content from a Filter Array Action

     How to Filter Items by a Key

    How to Filter Items by Matching a Substring

    How to Use Multiple Conditions in a Filter Array Action

     

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response! If you're feeling generous— ️  Buy me a coffee: https://www.buymeacoffee.com/acreativeopinion

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on
    TikTok

    @CrimellaD

  • CrimellaDn Profile Picture
    8 on at

    I have gone trough the proposed videos, as of right now I think I have isolated the problem as follows:

     

    Query: and(contains(body('Join_-_Codes_String_from_Excel'),item()?['Title']),not(equals(6,item()?['ID']))) the first part correctly filters the codes based on the Title string, second part works and also removes the item with ID of 6 (this was for debugging purposes)
    Query: and(contains(body('Join_-_Codes_String_from_Excel'),item()?['Title']),not(equals(body(Select_IDs_to_remove),item()?['ID']))) only the first part works, the second one doesn't apply any changes
    output of Select_IDs_to_remove action has body = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
     
    Any idea on why the condition is not applied when comparing it on an array?
     
    Thank you as always
    Daniele
     
    (sorry for the different nickame but I need to use multiple Microsoft accounts)
  • CrimellaDn Profile Picture
    8 on at

    I followed the suggested methods, and I think I have been able to isolate the problem:

    • Query: and(contains(body('Join_-_Codes_String_from_Excel'),item()?['Title']),not(equals(body('Select_-_Relationships'),item()?['ID']))) : only the first part of the "and" works and filters the input (which is a Get Items body output) the "not equals" does not apply any changes. The filtering array has body = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and I need to remove the items with that ID values from my list.
    • Query: and(contains(body('Join_-_Codes_String_from_Excel'),item()?['Title']),not(equals(6,item()?['ID']))) : this works and filters the List based on the Excel file data and also removes the item with ID=6

    I am really not sure why this condition doesn't work when entering the array of IDs instead of the single value I have put in for debugging purposes.

     

    Thanks for the support!

  • CrimellaDn Profile Picture
    8 on at

    I followed the suggested methods, and I think I have been able to isolate the problem:

    Query: and(contains(body('Join_-_Codes_String_from_Excel'),item()?['Title']),not(equals(body('Select_-_Relationships'),item()?['ID']))) : only the first part of the "and" works and filters the input (which is a Get Items body output) the "not equals" does not apply any changes. The filtering array has body = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and I need to remove the items with that ID values from my list.
    Query: and(contains(body('Join_-_Codes_String_from_Excel'),item()?['Title']),not(equals(6,item()?['ID']))) : this works and filters the List based on the Excel file data and also removes the item with ID=6
    I am really not sure why this condition doesn't work when entering the array of IDs instead of the single value I have put in for debugging purposes.

     

    Thanks for the support!

    @creativeopinion 

  • CrimellaD Profile Picture
    10 on at

    I followed the suggested methods, and I think I have been able to isolate the problem:

     

    Query: and(contains(body('Join_-_Codes_String_from_Excel'),item()?['Title']),not(equals(body('Select_-_Relationships'),item()?['ID']))) : only the first part of the "and" works and filters the input (which is a Get Items body output) the "not equals" does not apply any changes. The filtering array has body = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and I need to remove the items with that ID values from my list.

    Query: and(contains(body('Join_-_Codes_String_from_Excel'),item()?['Title']),not(equals(6,item()?['ID']))) : this works and filters the List based on the Excel file data and also removes the item with ID=6

    I am really not sure why this condition doesn't work when entering the array of IDs instead of the single value I have put in for debugging purposes.

     

     

     

    Thanks for the support!

  • CrimellaDn Profile Picture
    8 on at

    I followed the suggested methods, and I think I have been able to isolate the problem:

    Query: and(contains(body('Join_-_Codes_String_from_Excel'),item()?['Title']),not(equals(body('Select_-_Relationships'),item()?['ID']))) : only the first part of the "and" works and filters the input (which is a Get Items body output) the "not equals" does not apply any changes. The filtering array has body = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and I need to remove the items with that ID values from my list.
    Query: and(contains(body('Join_-_Codes_String_from_Excel'),item()?['Title']),not(equals(6,item()?['ID']))) : this works and filters the List based on the Excel file data and also removes the item with ID=6
    I am really not sure why this condition doesn't work when entering the array of IDs instead of the single value I have put in for debugging purposes.

     

    Thanks for the support!

     

    (sorry for the different alias but I need to use different MS Accounts depending on where I am working from and I can't switch them)

  • Suggested answer
    MiaOtt Profile Picture
    20 on at
    I imagine since this was posted a bit ago, you found a solution. However, I was facing this issue too and found a solution that I'll share in case others come across this post too. 
     
    For some reason the type of the array items to search and the ID weren't being read the same (either as integer or string) so I ended up wrapping the item in string when I grabbed the list of IDs into a select... and then in the filter array query, I also wrapped the item ID in string.
     
    Example: in the Select MAP: string(item()?['ClassID']) and in the Filter Array Query: @contains(body('Select-ClassIDonly'), string(item()?['ClassID']))

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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard