cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thomas_d
Level 8

Filtering Gallery using dropdown and Contains

Hi, I'm trying to filter a Gallery with a Dropdown. (Gallery is connected with a SP-Doc Libray)

 

The Sharepoint-DocLib have one collumn (Collumn1) with different informations in it. (for Example, one document with: Role1, another one with: Role1 and Role2)

 

The Dropdown have the values: Role1, Role2, Role3

 

on the Gallery item i add:

Filter(DocLib,Collumn1=Dropdown1.Selected.Value)

 

That worked fine. The Problem is, that this only show the Documents with the exact match (text from dropdown).

But not the Items who has more than one (Dokument with Role1 and Role2)

 

So i think i should add something like a "contains = the dropdown value" in my filterfunction. How can i do that?

 

thx for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft Employee

Re: Filtering Gallery using dropdown and Contains

Assuming that all the control and sources exist (DocLib, TextInput1, Column1, "Name") the formula should work. AllItems is an output property and cannot be assigned to. Also, make sure paste just the Search(Filter....) portion in the Gallery1.Items field (assyuming that you have Gallery1). Please check this page for more details on how the gallery works: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-gallery

 

7 REPLIES 7
Microsoft Employee

Re: Filtering Gallery using dropdown and Contains

Is your "DropDown" a ComboBox control? If so then please try this:

Filter(DocLib,Collumn1 in Dropdown1.SelectedItems)

thomas_d
Level 8

Re: Filtering Gallery using dropdown and Contains

No it is a "normal" dropdown
Microsoft Employee

Re: Filtering Gallery using dropdown and Contains

Please try the following formula then:

Filter(DocLib,Dropdown1.Selected.Value in Collumn1)

thomas_d
Level 8

Re: Filtering Gallery using dropdown and Contains

Thanks, that works fine. Smiley Wink thx

 

Do you have maybe a solution when i want to Setup a search box too? on the same Gallery...

 

Doc-Filter:

Filter(DocLib, Dropdown1.Selected.Value in Collumn1)

 

for Search:

IF(TextInput1.text="Search", DocLib, Search(DocLib, Textinput1.text, '{Name}'))

 

I'm not sure how to match this two together correctly...

Microsoft Employee

Re: Filtering Gallery using dropdown and Contains

Is your intent to search the filtered content (search by the "Name" column with the value from TextInput control the content that is already filtered by "Column1" column with the value from DropDown)? If so then:

Gallery1.Items=Search(Filter(DocLib, Dropdown1.Selected.Value in Collumn1), TextInput1.Text, "Name")

 

If however you need to search by "Name" column when the TextInput value is present but filter by "Column1" column when the value is not present, then:

Gallery1.Items=If(IsBlank(TextInput1.Text)=true,Filter(DocLib, Dropdown1.Selected.Value in Collumn1), Search(DocLib, TextInput1.Text, "Name"),"present")

thomas_d
Level 8

Re: Filtering Gallery using dropdown and Contains

Hello Thanks for your Input. I've tried the first one (because i want search in the filtered items), but it don't work.

 

Gallery1.Items=Search(Filter(DocLib, Dropdown1.Selected.Value in Collumn1), TextInput1.Text, "Name")

 

It shows a error on the ".items" and "in". Is it possible thats it should be ".allitems"?

i tried it with that but also not working.

Microsoft Employee

Re: Filtering Gallery using dropdown and Contains

Assuming that all the control and sources exist (DocLib, TextInput1, Column1, "Name") the formula should work. AllItems is an output property and cannot be assigned to. Also, make sure paste just the Search(Filter....) portion in the Gallery1.Items field (assyuming that you have Gallery1). Please check this page for more details on how the gallery works: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-gallery

 

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: 53 members 4,691 guests
Please welcome our newest community members: