cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Dropdown not working correctly as filter for gallery

I'm new to PowerApps, so excuse what is probably a simple question. I'm adding a dropdown to my app and I want it to filter the gallery results. My dropdown is called Dropdown1, table is Products, and the column is StoreNum. Here is what I have in teh OnSelect of the dropdown: Filter(Products,StoreNum = Dropdown1.Selected.Value)

 

I get no errors, and when I test it, it spins for a minute and then continues displaying the unfiltered results. What am I doing wrong?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Dropdown not working correctly as filter for gallery

Hi Tambe257,

 

Please try to set the Items property of the Gallery control as Filter(Products,StoreNum = Dropdown1.Selected.Value).


This part “Build an app from scratch” in this documentation about “Understand data forms in Microsoft PowerApps” could be a reference for you:
https://powerapps.microsoft.com/en-us/tutorials/working-with-forms/

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
PowerApps Staff FelixCuadrilla
PowerApps Staff

Re: Dropdown not working correctly as filter for gallery

I don't know if I got this straight, but I think I created something similar to what you need. I think the problem is that you are trying to set the value of the dropdown (or you meant gallery?) from the OnSelect option which cannot change the contents of the dropdown (unless you store that into a variable, but thats not needed for this example).

 

In this example, my table is name AWProducts, my dropdown DropDown1 and my column name sport:

 

example.png

 

 As you can see I'm setting the Items property in the gallery as the result of the filtered dropdown.

 

Replace AWProducts with Products and Sport with StoreNum and you should have a similar result.

 

 

Community Support Team
Community Support Team

Re: Dropdown not working correctly as filter for gallery

Hi Tambe257,

 

Please try to set the Items property of the Gallery control as Filter(Products,StoreNum = Dropdown1.Selected.Value).


This part “Build an app from scratch” in this documentation about “Understand data forms in Microsoft PowerApps” could be a reference for you:
https://powerapps.microsoft.com/en-us/tutorials/working-with-forms/

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

Re: Dropdown not working correctly as filter for gallery

Thanks Mabel. I had put the filter on the dropdown instead of the gallery itself. Now one more question....

 

The filter works great. I and filtering products per store, so the dropdown selects a store #, and only shows the products at that store. I also want to search those filtered products. I have a text input called TextInput1 and am searching the column called ItemNameWeight. I tried:

 

Search(Filter(Products,StoreNum = Dropdown1.Selected.Value), TextInput1.Text,"ItemNameWeight")

 

When I use the above code the filter of the store works, but then when I search, it returns the search items from all stores. How can I limit it to searching only the filtered items?

 

I also tried to create a search button. I have this in the OnSelect of the button: UpdateContext({ searchTerm: TextInput1.Text }) and I changed the above code to this:

 

Search(Filter(Products,StoreNum = Dropdown1.Selected.Value), searchTerm,"ItemNameWeight")

 

If I choose a store number and search a blank input, then it returns the store products, but if I choose a store and search "Coke" for instance, I get all of the Coke products at all of the stores, regardless of what store number is in the dropdown.

 

Thanks in advance for the help!

 

Anonymous
Not applicable

Re: Dropdown not working correctly as filter for gallery

Yes, thanks!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,465)