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 Apps / Filter Array to find S...
Power Apps
Answered

Filter Array to find Single Data Attribute from Array Variable

(0) ShareShare
ReportReport
Posted on by 439

Hi everyone,

 

This is probably quite an easy one to resolve but I'm wasting quite a lot of time trying to understand where the issue is and would really appreciate some help.

 

I have set up an Array variable, 'varArray'. Inside this is a set of records, each with two attributes, Attribute1 and Attribute2.

 

I have a second String variable, 'varString1'. Inside this is a string which will match the Attribute 2 value of one record in varArray.

 

I have set up an Apply to Each using the value of varArray.

Inside the Apply to Each I have set a Filter Array action to try to 'filter' varArray, when 'Attribute2' contains 'varString1'. 

 

I want to then set another variable which contains the output of the filter query.

 

I have had a series of errors, or, the filter query will return a null output even though there is definitely a match between Attribute2 and varString1, and tried to correct various aspects of the filter query but I'm not sure where the problem lies so any assistance would be much appreciated. Many thanks!

Categories:
I have the same question (0)
  • Verified answer
    BhaskarDhone Profile Picture
    1,392 Super User 2025 Season 2 on at

    If I understand correctly, you don't need Apply to each. Try something like below

    ClearCollect(
     varArray,
     { Attribute1: "Value1", Attribute2: "MatchValue1" },
     { Attribute1: "Value2", Attribute2: "MatchValue2" },
     { Attribute1: "Value3", Attribute2: "MatchValue3" }
    );
    
    Set(varString1, "MatchValue2");
    
    ClearCollect(
     varFilteredArray,
     Filter(varArray, Attribute2 = varString1)
    );
  • pp365 Profile Picture
    439 on at

    Hi @BhaskarDhone , my apologies, through force of habit I've written this in the Power Apps community whereas it should have been in Power Automate!

     

    I'll mark your suggestion as the Solution in case anyone is looking for this in the context of Power Apps.

     

    Thanks again!

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard