I have a basic Gallery on a screen and need to filter it based on the (possibly) multiple selections in the Combo Box control (not the drop-down).
I can't find a working solution for this. Any ideas?
You can use the in operator to check if one of the properties of the element in the collection that is being filtered was selected in the combobox, using the combobox SelectedItems property. For example, if you have a combobox with the following expression for the Items element:
["Produce", "Dairy", "Household Items", "Bakery", "Meats", "Pantry"]
And a data source (Products) with a column named "Department". If you want to show in a gallery the items for the selections, you can use this expression:
Filter(Products, Department in ComboboxDepartments.SelectedItems.Value)
Thanks, Carlos, but it's not working. I might be missing something obvious. Here are the details.
This is my Combo:
And this is my Gallery's formula on Items. The Inventory data source is a SharePoint List, and ItemType is a Choice column.
And the resulting error:
Hi,
I was having the same issue as well, after tinkering with varoius ways of doing this,
found that the formula mentioned before works with just a bit of a minor change.
You have to add .Id to Departments and change the SelectedItems.Value to
SelectedItems.ID
Filter(Products, Department.Id in ComboboxDepartments.SelectedItems.ID)
At least this works on my end, my data is from SharepointLists.
I am having the same problem and haven't seen a clear answer anywhere on this either. Anybody have any answers for this issue?
I have data in SQL Server and am using this equivilant to allow multiple selections.
Filter(Products, Id in ComboboxDepartments.SelectedItems.ID)
In case anyone else experience this issue, the formula should list the column name after the SelectedItems.
Example:
Filter(DataSource, ColumnName in ComboBox.SelectedItems.ColumnName)
This worked great!
As a potential bonus for functionality, I set up my Gallery to change based on the search text until a user selected an item, then it switches to display only selected items:
If(CountRows(ComboBox.SelectedItems) = 0 || IsBlank(ComboBox.SelectedItems) , Search(DataSource, ComboBox.SearchText, ColumnName, Filter(DataSource, ColumnName in ComboBox.SelectedItems.ColumnName))
Edit: Had to add an 'Or' condition for initial loads where the ComboBox.SelectedItems is blank.
Hero, after lots of tinkering and frustration... this was exactly the thing I was looking for.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
183 | |
53 | |
41 | |
36 | |
30 |
User | Count |
---|---|
242 | |
82 | |
71 | |
69 | |
65 |