cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenGillard
Level: Powered On

Filtering and Seraching in a Gallery

I currently have this formula which allows me to search a gallery as well as filter the gallery when a check box is Checked.

Search(If(ConnectCheck=true,Search(DS_Howdoi,"Connect","Category"),DS_Howdoi),
TextInput1.Text,"Title")

I am now struggling however to increase the formula further to incroporate my 3 other filtering check boxes.

If(CommunicateCheck=true,Search(DS_Howdoi,"Communicate","Category"),DS_Howdoi),
TextInput1.Text

If(ProductivityCheck=true,Search(DS_Howdoi,"Productivity","Category"),DS_Howdoi),
TextInput1.Text

If(CollaborateCheck=true,Search(DS_Howdoi,"Collaborate","Category"),DS_Howdoi),
TextInput1.Text

Any help would be great

 


Accepted Solutions
BenGillard
Level: Powered On

Re: Filtering and Seraching in a Gallery

Thanks for all the responses. Got there with a full solution in the end utilising the helpful comments on this thread.

My gallery now filters the results using 4 checkboxes and also allows the user to search at any point. 

Filter(Search(DS_Howdoi,TextInput1.Text,"Title"),If(
    Checkbox1.Value=true,Category="Connect",
    Checkbox1_1.Value=true,Category="Communicate",
    Checkbox1_3.Value=true,Category="Productivity",
    Checkbox1_2.Value=true,Category="Collaboration",
    Checkbox1.Value=false,!IsBlank(Category)))

I am sure there are many more ways to do this but it works for me.


All Replies
Super User Rank
Super User

Re: Filtering and Seraching in a Gallery

Hi Ben, I think you are making it more complicated than it needs to be. If I understand the problem, you want to fill the gallery with items that match the text in a single TextInput box. Search can search as many columns as you want for the same text. The syntax is: Search(Table, SearchString, Column1 [, Column2, ... ] ). In your case, Search(DS_Howdoi,, TextInput1.Text, "Title", "Communicate","Productivity","Collaborate") will return any instance of the text in the TextInput box found in any of the specified columns. Once you have that result, is there another field in the table that you want to filter the resulting gallery by based on the Checkboxes?
BenGillard
Level: Powered On

Re: Filtering and Seraching in a Gallery

No sorry, I want to Search the gallery using the text input. But I also want the ability to use the four checkboxes to filter my gallery, but still allow the user to search the gallery when various filters (check boxes) are selected.
The formula currently allows this to happen but it’s only incorporating one checkbox not all four.
Hope this makes more sense
Super User Rank
Super User

Re: Filtering and Seraching in a Gallery

Do you want the filters as Or or And? Can more than one be applied at the same time?

BenGillard
Level: Powered On

Re: Filtering and Seraching in a Gallery

Ideally I would like the user to be able to apply mullitple filter at one at a time if possible. But as a minimum want them to be able to still search the filtered results which I currently allows me to do but as I mentioned it’s only works with the one checkbox at the moment.
Super User Rank
Super User

Re: Filtering and Seraching in a Gallery

What is the category you are referring to in your formula?

BenGillard
Level: Powered On

Re: Filtering and Seraching in a Gallery

Hi,
Category is my Column which breaks the data into four ‘categories’, Connect, Communicate, Collaborate and Productivity.
Thanks
Super User Rank
Super User

Re: Filtering and Seraching in a Gallery

Hi @BenGillard,ListboxAndTextbox.PNGI wasn't able to figure out how to filter your list based on the checkboxes but I successfully was able to do it with a Listbox and a Textbox control. The relevant formula is 

Filter(Search(countries,TextInput1.Text, "CapitalName" ,"CountryName"),
Continents_ID in ListBox1.SelectedItems.ID

In the example, I had one list, countries ,of all of the countries and capitals and a foreign key "Continents_ID" that was the ID of a second list, Continents that consisted of just the continent names and an ID.  That list was used to populate the listbox control. The gallery filters dynamically with changes in the listbox and the list is also filtered on the textbox.  While it is not an exact solution with checkboxes, I think the result is functionally what you are looking to do, so I think I'm heading in the right direction.  Perhaps there is a way to hide the listbox and dynamically select items in the listbox control by checking a box.  Hopefully, what I came up with will help you move a bit forward.

BenGillard
Level: Powered On

Re: Filtering and Seraching in a Gallery

Thanks for this, you gave me a new thought process which is almost a perfect solution:

I know have the drop down, and the formula for my gallery is now this:

Filter(Search(DS_Howdoi,TextInput1_1.Text,"{Name}"),Category in Dropdown1_1.Selected.Value)

The only issue remaining is the drop down now always has one of my four options selected. Therefore the list is always filtered in some way. If I could get the dropdown Value to default as not selected so that the gallery would show the full unfiltered list, and then will only filter when the drop down is used. The reason is a think most people using the data will favour just typing key words.

Thanks again

BenGillard
Level: Powered On

Re: Filtering and Seraching in a Gallery

Thanks for all the responses. Got there with a full solution in the end utilising the helpful comments on this thread.

My gallery now filters the results using 4 checkboxes and also allows the user to search at any point. 

Filter(Search(DS_Howdoi,TextInput1.Text,"Title"),If(
    Checkbox1.Value=true,Category="Connect",
    Checkbox1_1.Value=true,Category="Communicate",
    Checkbox1_3.Value=true,Category="Productivity",
    Checkbox1_2.Value=true,Category="Collaboration",
    Checkbox1.Value=false,!IsBlank(Category)))

I am sure there are many more ways to do this but it works for me.