Help! Filter Gallery with Multiple Combo Box

%3CLINGO-SUB%20id%3D%22%5C%26quot%3Blingo-sub-3167168%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3EHelp!%20Filter%20Gallery%20with%20Multiple%20Combo%20Box%26lt%3B%5C%2Flingo-sub%26gt%3B%3CLINGO-BODY%20id%3D%22%5C%26quot%3Blingo-body-3167168%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CP%3EHi%20All%2C%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EI%20have%20created%20a%20gallery%20and%20multiple%20Combo%20boxes%20which%20pull%20data%20from%20SharePoint.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EI%20have%20created%20a%20filter%2C%20but%20when%20any%20Combo%20Box%20is%20blank%2C%20it%20doesn't%20work.%20Do%20you%20know%20how%20to%20amend%20the%20code%20so%20that%20the%20filter%20works%20when%20the%20Combo%20Boxes%20are%20blank%20or%20when%20a%20selection%20is%20chosen%3F%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EFilter('SharePoint%20FAQ'%2C%20(TextInput1.Text%20in%20Title%20%7C%7C%20TextInput1.Text%20in%20Description%20%7C%7C%20TextInput1.Text%20in%20Topic.Value)%20%26amp%3B%26amp%3B%20(Topic.Value%20in%20ComboBox5.SelectedItems.Value)%20%26amp%3B%26amp%3B%20('Target%20Audiance'.Value%20in%20ComboBox4.SelectedItems.Value)%20%26amp%3B%26amp%3B%20(Category.Value%20in%20ComboBox2.SelectedItems.Value)%20%26amp%3B%26amp%3B%20('SP%20Version'.Value%20in%20ComboBox3.SelectedItems.Value))%26lt%3B%5C%2FP%26gt%3B%26lt%3B%5C%2Flingo-body%26gt%3B%3CLINGO-LABS%20id%3D%22%5C%26quot%3Blingo-labs-3167168%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%26lt%3B%5C%2Flingo-label%26gt%3B%3CLINGO-LABEL%3EPowerApps%26lt%3B%5C%2Flingo-label%26gt%3B%3CLINGO-LABEL%3ESharePoint%26lt%3B%5C%2Flingo-label%26gt%3B%26lt%3B%5C%2Flingo-labs%26gt%3B%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3C%2FLINGO-SUB%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3172261%22%20slang%3D%22en-US%22%3ERe%3A%20Help!%20Filter%20Gallery%20with%20Multiple%20Combo%20Box%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3172261%22%20slang%3D%22en-US%22%3E%3CP%3EDoes%20anyone%20have%20any%20ideas%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi All,

 

I have created a gallery and multiple Combo boxes which pull data from SharePoint.

 

I have created a filter, but when any Combo Box is blank, it doesn't work. Do you know how to amend the code so that the filter works when the Combo Boxes are blank or when a selection is chosen?

 

Filter('SharePoint FAQ', (TextInput1.Text in Title || TextInput1.Text in Description || TextInput1.Text in Topic.Value) && (Topic.Value in ComboBox5.SelectedItems.Value) && ('Target Audiance'.Value in ComboBox4.SelectedItems.Value) && (Category.Value in ComboBox2.SelectedItems.Value) && ('SP Version'.Value in ComboBox3.SelectedItems.Value))

2 Replies

Does anyone have any ideas?

@Alexread1765 I don't know if this will directly help you but for one of my apps I have a couple of dropdowns rather than comboboxes. The user can select from either or both and it will filter the gallery accordingly.

 

1-ddEverything.png

 

2-ddEverywhere.png

 

I try not to leave a blank selection for my dropdowns and comboboxes where possible and so in the OnVisible property for the screen I have used the following which creates the first item as "Everywhere" or "Everything" as appropriate and then creates the collection:

 

ClearCollect(colItems, {Result: "Everything"});
Collect(colItems, Distinct(SurveyEquipment, Category));
ClearCollect(colEverywhere, {Result: "Everywhere"});
Collect(colEverywhere, Distinct(SurveyOffices, Title));

 

3-onVisible.png

 

Then in the items property of the gallery I have used the following to check the different combination of possible selections and filter the gallery:

Sort( 
    If(ddCategory.Selected.Result="Everything" And ddLocation.Selected.Result = "Everywhere", 
Filter(colEquipment, Available=true),
ddCategory.Selected.Result="Everything" And ddLocation.Selected.Result <> "Everywhere",
Filter(colEquipment, Location= ddLocation.Selected.Result && Available=true),
ddCategory.Selected.Result <> "Everything" And ddLocation.Selected.Result = "Everywhere",
Filter(colEquipment, Category = ddCategory.Selected.Result && Available=true),
ddCategory.Selected.Result <> "Everything" And ddLocation.Selected.Result <> "Everywhere",
Filter(colEquipment, Category = ddCategory.Selected.Result And Location = ddLocation.Selected.Result && Available=true)),Category,Ascending)

  

4-galItems.png

 

5-itemsDropdown.png

 

Hope that gives you some ideas.

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)