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

Filter and search

I have a gallery which displays the contents of a SP online Document Library ("Documents"). I have a dropdown box ("DropDown1") which allows selection of a department and this dropdown is populated from a Collection ("Departments"). I have a TextSearchBox ("TextSearchBox1").

 

I want to display all items in the gallery until:

  1. A user inputs text into TextSearchBox1 - this should then search the "Name" Column of "Documents"
  2. A user makes a selection from "DropDown1" which will filter against the "Department" column of "Documents"

These two actions need to be independant of each other, that is to say that a search will result in returns regardless of whether or not the dropdown has had a selection made and the filter should return results whether or not the search box has text in it.

 

My current code is as follows:

SortByColumns(Search(Filter('Site Content Templates',Deptartment=Dropdown1.SelectedText.Value),
        TextSearchBox1.Text,
        "{Name}","Department"),"{Name}",If(SortDescending1, Descending, Ascending))

 

There are two issues with this:

  1. It doesn't show all items as default
  2. as a result of point 1, the search function only works if the dropdown has a selection.

I'm fairly new at all of this and really need some assistance to make this work. 

 

Thansk very much for your assistance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Filter and search

Hi @JustinR 

 

Looks like you need to do a check to ensure the dropdown is not blank

you can also include an All option in your dropdown control

 

check this video for more details

https://www.youtube.com/watch?v=pn50AKn3Q1Y

 

 

Regards,

Reza Dorrani

 

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

1 REPLY 1
Dual Super User
Dual Super User

Re: Filter and search

Hi @JustinR 

 

Looks like you need to do a check to ensure the dropdown is not blank

you can also include an All option in your dropdown control

 

check this video for more details

https://www.youtube.com/watch?v=pn50AKn3Q1Y

 

 

Regards,

Reza Dorrani

 

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

Helpful resources

Announcements
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

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

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,704)