cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GoGorilla
Helper III
Helper III

Search gallery with a Combobox that displays All if no choice made

I need to search a gallery using a combobox for the ability to use the Search fields property.  My dropdown search fields display All if no choice is made or Result = "0" but when using the same function in the Items property of the combobox, not all of the items display adn the InputTextPlaceholder property displays.  The following is the function I am using.  Apparently the Value != 0 when nothing is chosen.  What am I missing?

 

With({_items: Sort(Distinct(EmpDB, LUContractName.Value), Result)},
    ForAll(Sequence(CountRows(_items)+1, 0),
        {Result: If(Value=0, "All", Last(FirstN(_items, Value)).Result )}
    )
)

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @GoGorilla ,

 

The thing is Combo boxes allow empty selection when you have not set the DefaultSelectedItems property of it, while the Dropdowns will have their AllowEmptySelection be false by default:

vjefferni_0-1637132831301.png

vjefferni_1-1637132852965.png

 

So, if you want "All" to be selected by default in the Combo box, set DefaultSelectedItems to

{Result:"All"}

vjefferni_2-1637133183232.png

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

4 REPLIES 4
RandyHayes
Super User
Super User

@GoGorilla 

I'm not exactly following what the issue is.  You have that formula on your Items property of the Combobox...are you stating that the Items do not appear properly?

Your Combobox is going to have (with that formula) a single column table with a column called Result, so I am not sure what you are comparing with the Value != 0 statement.  

Can you expand a little more please?

_____________________________________________________________________________________
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 In the image attached, note that the other dropdowns show All where the combo box shows the find items for searching the field.  In the combo box, if the All is not default, when doing a search by Employee name in the Employee Name text search, it will not find every employee.  If I change the combo box to All, then it finds everyone.  I am not sure why this is happening.  All of the search text fields and dropdowns worked fine until I added the combobox.  The result should be if value = 0 then display All but the value apparently is not 0.  

GoGorilla_0-1636821142877.png

 

GoGorilla
Helper III
Helper III

@RandyHayes  What was happening was the default value for the combobox is blank therefore, it would only display those with no value in the Contracts field; therefore, when trying to use the text search fields, it would only find those with blank Contract values.  I set the DefaultSelectedItem property to {Result: "All"}.  This fixed the problem.  Thank you for your help.

Hi @GoGorilla ,

 

The thing is Combo boxes allow empty selection when you have not set the DefaultSelectedItems property of it, while the Dropdowns will have their AllowEmptySelection be false by default:

vjefferni_0-1637132831301.png

vjefferni_1-1637132852965.png

 

So, if you want "All" to be selected by default in the Combo box, set DefaultSelectedItems to

{Result:"All"}

vjefferni_2-1637133183232.png

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,775)