cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lyoung
Level: Powered On

Cascading Dropdowns as Filters for Gallery

Hello,

I am struggling with filtering a gallery based on two different dropdown boxes.  I have got it to work where if both dropdowns are blank then it returns all results in the gallery. I have also got it to work where if you make a selection in dropdown1 then it filters your choices in dropdown1_1 and then if you select a choice from dropdown1_1 it filters the gallery further based on that selection.  The problem I am running into is that if I make a selection in dropdown1 but I select (blank) no value in dropdown1_1 it won’t filter based on dropdown1 alone and nothing is returned. In addition I have a search box that needs to function searching in the ProductName & ItemNo columns.  

 

The app is a shopping app so dropdown1 has selections like Mens, Womens, Youth, etc.  and then dropdown1_1 has further selections like Outerwear, T-Shirts, Headwear, etc.   I want the gallery to display all items when it is loaded and both dropdowns to be blank which it currently does.  I then want to be able to select from just dropdown1 such as Mens and the gallery displays all Mens items, then you can filter more if you want based on dropdown1_1.  Currently it will not display all items for selection made in dropdown1 but if you select a category from dropdown1 and dropdown1_1 then it displays only those items.

I am pulling all the products in from SharePoint to a collection in PowerApps called AllProducts.  The items property for the gallery is set to:

 

Filter(AllProducts, If(IsBlank(Dropdown1.Selected.Value), true&&(SearchBoxText.Text in ProductName&ItemNo), Category1=Dropdown1.Selected.Value,Category2=Dropdown1_1.Selected.Value))

 

Dropdown1 Items Property:

Sort(Distinct('WeilerGear-Categories',Category1),Result)

 

Dropdown1_1 Items Property:

(Sort(Distinct(Filter('WeilerGear-Categories',Category1=Dropdown1.Selected.Value),Category2),Result))

1 ACCEPTED SOLUTION

Accepted Solutions
lyoung
Level: Powered On

Re: Cascading Dropdowns as Filters for Gallery

I solved this issue by changing the Gallery Items Property to:

 

Filter(AllProducts, If(IsBlank(SubCategory_Dropdown.Selected.Value), Category1=Category_Dropdown.Selected.Value&&(SearchBoxText.Text in ProductName&ItemNo), Category1=Category_Dropdown.Selected.Value,Category2=SubCategory_Dropdown.Selected.Value)Or If(IsBlank(Category_Dropdown.Selected.Value), true&&(SearchBoxText.Text in ProductName&ItemNo), Category1=Category_Dropdown.Selected.Value,Category2=SubCategory_Dropdown.Selected.Value))

1 REPLY 1
lyoung
Level: Powered On

Re: Cascading Dropdowns as Filters for Gallery

I solved this issue by changing the Gallery Items Property to:

 

Filter(AllProducts, If(IsBlank(SubCategory_Dropdown.Selected.Value), Category1=Category_Dropdown.Selected.Value&&(SearchBoxText.Text in ProductName&ItemNo), Category1=Category_Dropdown.Selected.Value,Category2=SubCategory_Dropdown.Selected.Value)Or If(IsBlank(Category_Dropdown.Selected.Value), true&&(SearchBoxText.Text in ProductName&ItemNo), Category1=Category_Dropdown.Selected.Value,Category2=SubCategory_Dropdown.Selected.Value))

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 50 members 4,886 guests
Please welcome our newest community members: