Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Filter Array to find Single Data Attribute from Array Variable

(0) ShareShare
ReportReport
Posted on by 402

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:
  • pp365 Profile Picture
    402 on at
    Re: Filter Array to find Single Data Attribute from Array Variable

    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!

  • Verified answer
    BhaskarDhone Profile Picture
    810 Super User 2025 Season 1 on at
    Re: Filter Array to find Single Data Attribute from Array Variable

    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)
    );

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard