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

Clear filter from gallery

Hi all,

 

I have a gallery that has its records being filtered. I want is a button or something for the filter to be removed and for all records to display like they did before being filtered. When I select an item from Gallery1, items in the table that have a matching location display on Gallery2. Gallery1 is just a gallery that displays a list of locations. 

 

Gallery1- Items: 

Distinct(SortByColumns(Testing_Database,"Location"), Location)

 

Gallery2- Items:

Filter(Search(Testing_Database,'Textbox Search'.Text, "Artist","Title","Location","Medium","Nationality"), Location = Gallery1.Selected.Result)

 

I've also realized that the search bar searches the entire table instead of just the items being filtered when the user selects a filter. Of course, if the user selects a filter they would only want to search through the filtered list not the entire table. How can I fix this?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Memorable Member
Memorable Member

If you want to search in filtered table then you have to put filter inside the search. Something like this

Gallery2- Items:
Search(Filter(Testing_Database,Location = Gallery1.Selected.Result),'Textbox Search'.Text, "Artist","Title","Location","Medium","Nationality")

For the button to cancel filtering and display whole table, insert button and in OnSelect proerty add

UpdateContext({filterOn:!true})

And in yout gallery items change it to something like this

If(filterOn=true, Search(Filter(Testing_Database,Location = Gallery1.Selected.Result),'Textbox Search'.Text, "Artist","Title","Location","Medium","Nationality"), TestingDatabase)

View solution in original post

2 REPLIES 2
Highlighted
Memorable Member
Memorable Member

If you want to search in filtered table then you have to put filter inside the search. Something like this

Gallery2- Items:
Search(Filter(Testing_Database,Location = Gallery1.Selected.Result),'Textbox Search'.Text, "Artist","Title","Location","Medium","Nationality")

For the button to cancel filtering and display whole table, insert button and in OnSelect proerty add

UpdateContext({filterOn:!true})

And in yout gallery items change it to something like this

If(filterOn=true, Search(Filter(Testing_Database,Location = Gallery1.Selected.Result),'Textbox Search'.Text, "Artist","Title","Location","Medium","Nationality"), TestingDatabase)

View solution in original post

Frequent Visitor

Thanks Sienna, it worked. Now the filter from the gallery can be cleared with a button and only the filtered results are being searched.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (11,618)