cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

Help with search on gallery that is filtered with multiple dropdowns

I have a gallery with a list of collection efforts where users can filter those results based on one of three drop downs, Customer Name, Hotel Name and Collector. I would like to also give users the ability to use a Search bar to search on any of the 7 visible columns but I am not sure how to add this to my current formula. 

 

Current formula for filtering:

If(!IsBlank(Dropdown4.Selected.Result), Filter('Collections DB','Customer Name' = Dropdown4.Selected.Result),
If(!IsBlank(drpdwnHotelName.Selected.Result), Filter('Collections DB', 'Hotel Name' = drpdwnHotelName.Selected.Result),
If(!IsBlank(Dropdown6.Selected.Result), Filter('Collections DB', 'Collector' = Dropdown6.Selected.Result),
'Collections DB')));

 

If I enter the following formula by itself I am able to Search based on Customer Name

Search('Collections DB',TextInput2.Text,"Customer_x0020_Name")

 

When I try to add another column like this:

Search('Collections DB',TextInput2.Text,"Customer_x0020_Name", "Hotel_x0020_Name")

 

The search no longer works and all results disappear from the gallery. Any help is greatly appreciated!

 

Thanks,

Carl

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Help with search on gallery that is filtered with multiple dropdowns

@CarlHRVA 

 

try this

 

If(!IsBlank(Dropdown4.Selected.Result),Search(Filter('Collections DB','Customer Name' = Dropdown4.Selected.Result),SearchBox.Text, "Customer_x0020_Name", "Title", "Invoice_x0020_Number", "HC_x0020_Type", "Balance_x0020_Amount","Contact_x0020_Name_x0020_and_x00"),
If(!IsBlank(Dropdown5.Selected.Result), Search(Filter('Collections DB', 'Hotel Name' = Dropdown5.Selected.Result),SearchBox.Text, "Customer_x0020_Name", "Title", "Invoice_x0020_Number", "HC_x0020_Type", "Balance_x0020_Amount","Contact_x0020_Name_x0020_and_x00"),
If(!IsBlank(Dropdown6.Selected.Result), Search(Filter('Collections DB', Collector = Dropdown6.Selected.Result),SearchBox.Text, "Customer_x0020_Name", "Title", "Invoice_x0020_Number", "HC_x0020_Type", "Balance_x0020_Amount","Contact_x0020_Name_x0020_and_x00"),
Search('Collections DB', SearchBox.Text, "Customer_x0020_Name", "Title", "Invoice_x0020_Number", "HC_x0020_Type", "Balance_x0020_Amount","Contact_x0020_Name_x0020_and_x00"))))

View solution in original post

16 REPLIES 16
Highlighted
Post Patron
Post Patron

Re: Help with search on gallery that is filtered with multiple dropdowns

I figured out what I was doing wrong with the search formula and I can make the search and the dropdown filters operate independently but I'm not sure how to combine search with filtering or if it's even possible. I tried getting around it by creating a second gallery(one for filtering and one for searching) and hiding and showing them but it's not an ideal solution as switching between the two galleries noticable and the data from your previous query is removed. Thanks in advance. 

 

Filtering formula:

If(!IsBlank(Dropdown4.Selected.Result), Filter('Collections DB','Customer Name' = Dropdown4.Selected.Result),
If(!IsBlank(Dropdown5.Selected.Result), Filter('Collections DB', 'Hotel Name' = Dropdown5.Selected.Result),
If(!IsBlank(Dropdown6.Selected.Result), Filter('Collections DB', Collector = Dropdown6.Selected.Result),
'Collections DB')))

 

Search Formula:

Search('Collections DB', SearchBox.Text, "Customer_x0020_Name", "Title", "Invoice_x0020_Number", "HC_x0020_Type", "Balance_x0020_Amount","Contact_x0020_Name_x0020_and_x00")

Highlighted
Dual Super User
Dual Super User

Re: Help with search on gallery that is filtered with multiple dropdowns

Hi @CarlHRVA 

 

If(!IsBlank(Dropdown4.Selected.Result),Search( Filter('Collections DB','Customer Name' = Dropdown4.Selected.Result),TextInput2.Text,"Customer Name"),
If(!IsBlank(drpdwnHotelName.Selected.Result), Search(Filter('Collections DB', 'Hotel Name' = drpdwnHotelName.Selected.Result),TextInput2.Text,"Hotel Name"),
If(!IsBlank(Dropdown6.Selected.Result), Search(Filter('Collections DB', 'Collector' = Dropdown6.Selected.Result),TextInput2.Text,"Collector"),
'Collections DB')));

 

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Post Patron
Post Patron

Re: Help with search on gallery that is filtered with multiple dropdowns

Thanks for responding Reza. Unfortunately this doesn't work for me.

 

Capture.PNG

 

What I've been able to achieve(with a lot of help) is filtering based on Customer Name, Hotel Name and Collector by using the first formula from my earlier post in the Items property of my gallery. I'm also able to erase the formula entirely and use the second formula to use the search field on a number of different columns. What I'd like to be able to both sort the list by the 3 columns but then also be able to search through those results based on the other columns in the list. Is something like that possible? Thanks so much for you help.

 

Highlighted
Dual Super User
Dual Super User

Re: Help with search on gallery that is filtered with multiple dropdowns

Hi @CarlHRVA 

 

Looks like you want to dynamically define your search column in your query

I dont believe that is possible

 

One option would be to use the same formula that I provided and add more conditions to check the search column name and accordingly change the search field query

 

So lets say the search column is dynamically picked by user from a dropdown

example: dropdown1 and has values Customer Name,Hotel Name and Collector

 

Switch(dropdown1.Selected.Result,"Customer Name",Search( Filter('Collections DB','Customer Name' = Dropdown4.Selected.Result),TextInput2.Text,"Customer Name"),"Hotel Name",Search(Filter('Collections DB', 'Hotel Name' = drpdwnHotelName.Selected.Result),TextInput2.Text,"Hotel Name"),"Collector",Search(Filter('Collections DB', 'Collector' = Dropdown6.Selected.Result),TextInput2.Text,"Collector"))

 

 

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

 

Highlighted
Dual Super User
Dual Super User

Re: Help with search on gallery that is filtered with multiple dropdowns

Hi @CarlHRVA 

 

The formula that I just gave is a reference 

 

You would have to add a complex formula like this to mix and match all your cases

Highlighted
Post Patron
Post Patron

Re: Help with search on gallery that is filtered with multiple dropdowns

I'm probably not doing a good job of explaining it, it's been a long day, or maybe I'm misunderstanding you but I don't think I wan't to dynamically define my search columns. If I use this formula for "Items" in my gallery I can search and get results based on all of the listed columns.

 

Search('Collections DB', SearchBox.Text, "Customer_x0020_Name", "Title", "Invoice_x0020_Number", "HC_x0020_Type", "Balance_x0020_Amount","Contact_x0020_Name_x0020_and_x00")

 

If I use this formula in "Items" for my gallery I can use one of the 3 dropdowns, Customer Name, Hotel Name or Collector, independently to filter the gallery. You can only filter based on one of the 3 dropdowns at a time. For example you cannot filter based on Customer Name and then Hotel Name.(because I don't know how to do that yet either)

 

If(!IsBlank(Dropdown4.Selected.Result), Filter('Collections DB','Customer Name' = Dropdown4.Selected.Result),
If(!IsBlank(Dropdown5.Selected.Result), Filter('Collections DB', 'Hotel Name' = Dropdown5.Selected.Result),
If(!IsBlank(Dropdown6.Selected.Result), Filter('Collections DB', Collector = Dropdown6.Selected.Result),
'Collections DB')))

 

 

 If possible like them to have the option of searching through their filtered results with the same columns we defined in the first formula, or using the search bar outright without filtering the list. Is that the same thing as defining it dynamically?

Highlighted
Dual Super User
Dual Super User

Re: Help with search on gallery that is filtered with multiple dropdowns

Hi @CarlHRVA 

 

If(!IsBlank(Dropdown4.Selected.Result),Search( Filter('Collections DB','Customer Name' = Dropdown4.Selected.Result),SearchBox.Text, "Customer_x0020_Name", "Title", "Invoice_x0020_Number", "HC_x0020_Type", "Balance_x0020_Amount","Contact_x0020_Name_x0020_and_x00")),
If(!IsBlank(drpdwnHotelName.Selected.Result), Search(Filter('Collections DB', 'Hotel Name' = drpdwnHotelName.Selected.Result),SearchBox.Text, "Customer_x0020_Name", "Title", "Invoice_x0020_Number", "HC_x0020_Type", "Balance_x0020_Amount","Contact_x0020_Name_x0020_and_x00")),
If(!IsBlank(Dropdown6.Selected.Result), Search(Filter('Collections DB', 'Collector' = Dropdown6.Selected.Result),SearchBox.Text, "Customer_x0020_Name", "Title", "Invoice_x0020_Number", "HC_x0020_Type", "Balance_x0020_Amount","Contact_x0020_Name_x0020_and_x00")),
Search('Collections DB', SearchBox.Text, "Customer_x0020_Name", "Title", "Invoice_x0020_Number", "HC_x0020_Type", "Balance_x0020_Amount","Contact_x0020_Name_x0020_and_x00"))));

 

This should work then

It is combining your original dropdown filter logic with the search logic you provided

Highlighted
Post Patron
Post Patron

Re: Help with search on gallery that is filtered with multiple dropdowns

Hi Reza,

 

Thank you. I think we are close but I'm getting errors on the commas after each if statement. If I change the commas to semicolons it changes the behavior but still throws an error. Screenshots below:

 

With the commas in place, only the first line of the formula pulls data dynamicallyWith the commas in place, only the first line of the formula pulls data dynamicallyIf I replace the commas with semicolons it fills in the rest of the data but throws an error about the expected operator but none that I have tried workIf I replace the commas with semicolons it fills in the rest of the data but throws an error about the expected operator but none that I have tried work

 

Thanks for your help!

Highlighted
Post Patron
Post Patron

Re: Help with search on gallery that is filtered with multiple dropdowns

Maybe the formula is okay with the semicolons I think it is just a delegation warning but all of the labels in my gallery now say "Name isn't valid. The identifier isn't recognized". I am setting the value of all the labels in my gallery using the ThisItem operator. For example:  ThisItem.'Hotel Name'. Thanks for all of your help.

 

Carl

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 (8,031)