Forum Discussion
Help! Filter Gallery with Multiple Combo Box
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.
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));
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)
Hope that gives you some ideas.
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)