cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Filter list by dropdown and search box

I have a gallery that has a dropdown filter and a search box and I'd like to be able to use both. I can get one or the other working, depending on the formula.

 

Search box (default)

SortByColumns(Filter(Trials, StartsWith(Title, TextSearchBox1_1.Text)), "Title", If(SortDescending1, Descending, Ascending))

Dropdown filter:

IF(Dropdown1.Selected.Value = "All Sites", Trials, Filter (Trials, Foundry.Value = Dropdown1.Selected.Value))

 

I'm having a hard time combining two formulas into one usable formula. I found some similar threads but couldn't apply them specifically to what I was going for.

 

Thank you

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User
Super User

Re: Filter list by dropdown and search box

Hi @Jensen

You can try something like this to combined the 2 formulas :

SortByColumns(Filter(Trials, StartsWith(Title, TextSearchBox1_1.Text) && (Dropdown1.Selected.Value="All sites" || Foundry.Value = Dropdown1.Selected.Value) ), "Title", If(SortDescending1, Descending, Ascending))

If "All sitess" is selected, the second condition is true so no need to filter the Foundry.Value. 

But if it's false, then the filter on foundry will operate. 

 

Théo

View solution in original post

Highlighted
Resident Rockstar
Resident Rockstar

Re: Filter list by dropdown and search box

@Jensen

 

@tchin-nin is right, you should do it as he said.

 

You could also do it like this (I find it easier to read):

SortByColumns(
	Filter(Trials, 
		IsBlank(TextSearchBox1_1.Text) || StartsWith(Title, TextSearchBox1_1.Text),
		Dropdown1.Selected.Value="All sites" || Foundry.Value = Dropdown1.Selected.Value
	)
	, "Title"
	, If(SortDescending1, Descending, Ascending)
)

You could also drop the DropDown and change to a ComboBox. A combobox can be with no selection. The formula then becomes like:

SortByColumns(
	Filter(Trials, 
		IsBlank(TextSearchBox1_1.Text) || StartsWith(Title, TextSearchBox1_1.Text),
		IsBlank(ComboBox.Selected.Value) || Foundry.Value = ComboBox.Selected.Value
	)
	, "Title"
	, If(SortDescending1, Descending, Ascending)
)

Hope this helps,

 

Paul

View solution in original post

5 REPLIES 5
Highlighted
Super User
Super User

Re: Filter list by dropdown and search box

Hi @Jensen

You can try something like this to combined the 2 formulas :

SortByColumns(Filter(Trials, StartsWith(Title, TextSearchBox1_1.Text) && (Dropdown1.Selected.Value="All sites" || Foundry.Value = Dropdown1.Selected.Value) ), "Title", If(SortDescending1, Descending, Ascending))

If "All sitess" is selected, the second condition is true so no need to filter the Foundry.Value. 

But if it's false, then the filter on foundry will operate. 

 

Théo

View solution in original post

Highlighted
Resident Rockstar
Resident Rockstar

Re: Filter list by dropdown and search box

@Jensen

 

@tchin-nin is right, you should do it as he said.

 

You could also do it like this (I find it easier to read):

SortByColumns(
	Filter(Trials, 
		IsBlank(TextSearchBox1_1.Text) || StartsWith(Title, TextSearchBox1_1.Text),
		Dropdown1.Selected.Value="All sites" || Foundry.Value = Dropdown1.Selected.Value
	)
	, "Title"
	, If(SortDescending1, Descending, Ascending)
)

You could also drop the DropDown and change to a ComboBox. A combobox can be with no selection. The formula then becomes like:

SortByColumns(
	Filter(Trials, 
		IsBlank(TextSearchBox1_1.Text) || StartsWith(Title, TextSearchBox1_1.Text),
		IsBlank(ComboBox.Selected.Value) || Foundry.Value = ComboBox.Selected.Value
	)
	, "Title"
	, If(SortDescending1, Descending, Ascending)
)

Hope this helps,

 

Paul

View solution in original post

Highlighted
Frequent Visitor

Re: Filter list by dropdown and search box

These work great, thank you very much!

Highlighted
Frequent Visitor

Re: Filter list by dropdown and search box

@KroonOfficeSol

 

What would I need to add to get a second dropdown filter to work with this?

Highlighted
Resident Rockstar
Resident Rockstar

Re: Filter list by dropdown and search box

@Jensen

 

Just add a comma and an extra line like the other dropdown. This one

Dropdown2.Selected.Value="All sites" || SecondField.Value = Dropdown2.Selected.Value


You can add as many you like.

 

Paul

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,761)