cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lauren_
Advocate III
Advocate III

Filter gallery by dropdowns

Hi folks, I have a gallery that I am filtering, for some reason when filtering on the two dropdowns(3&4), the gallery only acknowledges the choice on Dropdown3.


This is the snippet of function I'm using for this particular behaviour:

 

If(Not(Dropdown3.Selected.Value=" ")&&Not(Dropdown4.Selected.Value=" "),Filter(AllQHSE,Dropdown3.Selected.Value in Team,Dropdown4.Selected.Value in Category),

 

Where am I going wrong in this?🤔

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@Lauren_ 

Please consider changing your Formula to the following:

Filter(AllQHSE,
    (Dropdown3.Selected.Value=" " || Dropdown3.Selected.Value in Team) &&
    (Dropdown4.Selected.Value=" " || Dropdown4.Selected.Value in Category)
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

4 REPLIES 4
RandyHayes
Super User III
Super User III

@Lauren_ 

Please consider changing your Formula to the following:

Filter(AllQHSE,
    (Dropdown3.Selected.Value=" " || Dropdown3.Selected.Value in Team) &&
    (Dropdown4.Selected.Value=" " || Dropdown4.Selected.Value in Category)
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Lauren_
Advocate III
Advocate III

I'm a dope, it is working with the original formula 🙂 Thank you though Randy I have earmarked your solution for future galleries!!

RandyHayes
Super User III
Super User III

@Lauren_ 

The problem with your original formula though is that if the two conditions were not met, you were returning nothing.  Although this may work well in the editor, these are the kind of things that break apps in play mode.  You should return at least an empty table with a proper records schema based on when you do have results.  The formula I provided will give you that if no results are met.

This is one reason why it is generally bad practice to use If conditions for Items properties and filter statements.

 

Glad you got it working for now.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hey Randy,

 

Thanks for the concern! The extract I thought wasn't working is in a large piece of function, I do have an additional function for if none of the conditions are met, your suggestion has given me a new angle on the filtering of galleries though so thank you!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (109,755)