Does anybody know how I can get a Combo Box to default to all if nothing is selected?
At the moment, I have had to set the DefaultSelectedItems to be all values, as if I leave it blank, the search fails.
This means that if there are particular values that people don't want to search for, they have to deselect them.
I would rather, if possible, have people select the values they want to filter by, and be able to leave it blank if they want to search for everything.
Would greatly appreciate any help. 🙂
You can account for this in your formula by looking to see how many items are selected - if none, then assume all, if some, then filter on just those items.
CountRows(yourCombobox.SelectedItems) will return 0 if nothing is selected and you can use that to base your logic on.
I hope this is helpful for you.
Thanks for your response.
Where exactly would this command go? Would this be part of my formula for the filter gallery? (the one which loads when people select the options from the combo boxes and click search) Or would it be part of the properties for each ComboBox?
Yes it would be part of the Items property. What is your formula for that?
The formula for each ComboBox is currently
The formula for my filter gallery is:
Filter(ListName, FieldName1 in ComboBox2.SelectedItems, FieldName2 in ComboBox2_2.SelectedItems, FieldName3 in ComboBox2_1.SelectedItems, FieldName4 in ComboBox2_3.SelectedItems)
(yes, I know I should have named my ComboBoxes properly instead of just keeping the default name after copying them!)
If you have all four comboboxes that you want to apply this logic to, then your formula will be:
Filter(ListName, (CountRows(ComboBox2.SelectedItems)= 0 || FieldName1 in ComboBox2.SelectedItems) && (CountRows(ComboBox2_2.SelectedItems) = 0 || FieldName2 in ComboBox2_2.SelectedItems) && (CountRows(ComboBox2_1.SelectedItems) = 0 || FieldName3 in ComboBox2_1.SelectedItems) && (CountRows(ComboBox2_3.SelectedItems) = 0 || FieldName4 in ComboBox2_3.SelectedItems) )
Thank you, that's worked! Although I now have another issue.
I've currently got the DefaultSelectedItems for each of these ComboBoxes to be all options for that particular field.
If I clear this setting so nothing is selected by default, then when I select the values I want, the search fails.
Sorry to bump this, but was just wondering if anybody could advise on this?
The issue I now have, is that if I manually deselect the options on the ComboBox, the search works fine, but if I change the DefaultSelectedItems to none, the search fails.
Does anybody know why this might be?
Sorry to lose track of your post. Just seeing it now.
So tell me more about this scenario. What are the Items properties and the DefaultSelectedItems property formulas?
So, my list name is Register and I have four fields called Asset Type, Status, Location and Model, each of which has a ComboBox associated.
For each ComboBox, both the Items and DefaultSelectedItems properties are "Choices(Register.FieldName)" - e.g. "Choices(Register. 'Asset Type), "Choices(Register.Status)" and so on.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Join us on June 28 for our monthly User Group leader call!
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.