cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Motty_25
Helper I
Helper I

Default Blank Combobox to all

Hi,

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. 🙂

Many thanks

14 REPLIES 14
RandyHayes
Super User
Super User

@Motty_25 

Okay, so all of the comboboxes have a table with a single column record called Value with those formulas - and you are specifying all of the choices in your DefaultSelectedItems (DSI) property.

 

Where is the problem coming from?  You state that you set the DSI to none - what does that mean??

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

So, I cleared the value for the DSI property. This meant that none of the choices were selected by default when I start the app.
The problem, however, was that when I then selected the choices I wanted and clicked Search, it didn't return any results.

RandyHayes
Super User
Super User

@Motty_25 

Ah, gotcha now.  Yes, so the question would be, are you going the be getting rid of the DSI property?  The Item formula provided was based on the concept that you would have DSI items.

If you are getting rid of the DSI, then change the formula to the following:

Filter(ListName, 
    (IsBlank(ComboBox2.Selected.Value) || FieldName1 in ComboBox2.SelectedItems.Value) &&
    (IsBlank(ComboBox2_2.Selected.Value) || FieldName2 in ComboBox2_2.SelectedItems.Value) &&
    (IsBlank(ComboBox2_1.Selected.Value) || FieldName3 in ComboBox2_1.SelectedItems.Value) &&
    (IsBlank(ComboBox2_3.Selected.Value) || FieldName4 in ComboBox2_3.SelectedItems.Value)
)

The concept is essentially the same. The difference in this case is that we are looking at a singular record - the Selected record.  In a multi-select combobox, that record will be only the last selected item.  That is really all we need in order to determine if zero items are selected or 1 or more are selected.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

 

I tried inputting the above, made sure there were no errors in it and got rid of the DSI.
I then tried again, selecting a choice from each field and hit Search, but did not get any results back.

Thanks,
Ben

RandyHayes
Super User
Super User

@Motty_25 

You seem to have an extra step in your process that I am not aware of - you are mentioning you are hitting Search...what is that doing?

The formula I had provided was anticipated to be on the Items property of your Gallery.

So, tell me more about this search button.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,504)