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 / Return items in array ...
Power Automate
Answered

Return items in array where ID exists in another array

(0) ShareShare
ReportReport
Posted on by 51
Hi Experts
 
I have two arrays in a Power Automate Flow:
 
Array 1:
[
    {
        "ID": "A-111",
        "Name": "Process 1"
    },
    {
        "ID": "A-222",
        "Name": "Process 2"
    },
    {
        "ID": "A-333",
        "Name": "Process 3"
    },
    {
        "ID": "A-444",
        "Name": "Process 4"
    },
    {
        "ID": "A-555",
        "Name": "Process 5"
    },
    {
        "ID": "B-111",
        "Name": "Process 1.1"
    },
    {
        "ID": "B-222",
        "Name": "Process 2.1"
    },
    {
        "ID": "B-333",
        "Name": "Process 3.1"
    },
    {
        "ID": "B-444",
        "Name": "Process 4.1"
    },
    {
        "ID": "B-555",
        "Name": "Process 5.1"
    }
]
Array 2:
[
    {
        "ID": "A-111",
        "Name": "Process 1",
        "Environment": "Prod",
        "Application": "Application A"
    },
    {
        "ID": "A-333",
        "Name": "Process 3",
        "Environment": "Prod",
        "Application": "Application A"
    },
    {
        "ID": "B-222",
        "Name": "Process 2.1",
        "Environment": "Prod",
        "Application": "Application B"
    },
    {
        "ID": "B-555",
        "Name": "Process 5.1",
        "Environment": "Prod",
        "Application": "Application B"
    }
]
 
I need to filter Array 1 so it only shows items where the ID exists in both arrays. I know that it can be done by using Apply To Each but for better overview I would like to use the Filter Array. But I cannot get it to work. I have tried with converting Array 2 into a Dictionary-kind-of looking like this:
 
{
    "A-111": {
        "ID": "A-111",
        "Name": "Process 1",
        "Environment": "Prod",
        "Application": "Application A"
    },
    "A-333": {
        "ID": "A-333",
        "Name": "Process 3",
        "Environment": "Prod",
        "Application": "Application A"
    },
    "B-222": {
        "ID": "B-222",
        "Name": "Process 2.1",
        "Environment": "Prod",
        "Application": "Application B"
    },
    "B-555": {
        "ID": "B-555",
        "Name": "Process 5.1",
        "Environment": "Prod",
        "Application": "Application B"
    }
}
 
But then the Filter Array just returns an empty output.
Categories:
  • Verified answer
    Chriddle Profile Picture
    8,725 Super User 2026 Season 2 on at
    Create an array with the IDs of Array2 and filter for elements of Array1 whose ID is in this ID array:
     
     
    Compose-Array1
    Your Array 1
     
    Compose-Array2
    Your Array 2
     
    Select-Array-IDs
    From: @{outputs('Compose-Array2')}
    Map: @item()['ID']
     
    Filter array
    From: @outputs('Compose-Array1')
    Filter: @body('Select-Array2-IDs') contains @item()['ID']
     
     
    Output
  • jacchr1 Profile Picture
    51 on at
    Thanks @Chriddle
     
    Apparently I had made it correct but it seems there is a bug if running in the New Designer. It says "No outputs" under Outputs - but if clicking on Show raw outputs there actually is an output. Thanks to your example I switched to the "Classic designer" and found that there actually was an output.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 245 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 233 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 136 Super User 2026 Season 2

Last 30 days Overall leaderboard