cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Selecting "All" or Specific item in Combobox OnStart

Hello Community,

 

I have been working on this PowerApp for awhile and am learning how much of a pain multiple filters are within PowerApps. I have gotten most of the kinks worked out except for the issue below:

 

I need a way to eliminate step 1 in the instructions by loading "All" for each Combobox and connecting it to "AllItems" in the Gallery. I have already added Default = {Value: "All"} with ClearCollect() and Collect() creating the "All" option for each Combobox. I have also connected the "All" selection to the Gallery and it works properly.

My only issue is that users may not want to search all for each Combobox to find what the need even before filtering.

You would think there would be a simple OnStart formula that would remedy this...

 

I appreciate everyone's time!

 

EmilyWinonaIT_0-1595518409227.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Selecting "All" or Specific item in Combobox OnStart

@EmilyWinonaIT
Fortunately, 'All' is not necessary.  You can do the same thing with blank dropdowns using some fancy code like this gallery.

Filter(
    your_datasource_name,
    ComboBox_ProductTag.Selected=Blank() Or ProductTag=ComboBox_ProductTag.Selected
    And ComboBox_Division.Selected=Blank() Or Division=ComboBox_Division.Selected
    And ComboBox_PrivateFederal.Selected=Blank() Or PrivateFederal=ComboBox_PrivateFederal.Selected
    And Dropdown_Active.Selected=Blank() Or Active=ComboBox_Active.Selected
)

 
You would have to change this to match your own control names and data types.

 

Or you could just take the simple route and change all of the DEFAULT properties for your dropdowns to 'All'.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

View solution in original post

Highlighted
Frequent Visitor

Re: Selecting "All" or Specific item in Combobox OnStart

Ahh.. I figured out why it wasn't working right:

 

Filter(
'Marketing Catalog',
(cbProductTag.Selected.Value = Blank() Or ProductTag1.Value = cbProductTag.Selected.Value)
And (cbDivision.Selected.Value = Blank() Or Division.Value = cbDivision.Selected.Value)
And (cbPrivateFederal.Selected.Value = Blank() Or 'Private/Federal'.Value = cbPrivateFederal.Selected.Value)
And (ddActive.Selected.Value ="Yes")
)

 

The Or was throwing it off.

 

THANK YOU!!!

View solution in original post

5 REPLIES 5
Highlighted
Super User III
Super User III

Re: Selecting "All" or Specific item in Combobox OnStart

@EmilyWinonaIT
Fortunately, 'All' is not necessary.  You can do the same thing with blank dropdowns using some fancy code like this gallery.

Filter(
    your_datasource_name,
    ComboBox_ProductTag.Selected=Blank() Or ProductTag=ComboBox_ProductTag.Selected
    And ComboBox_Division.Selected=Blank() Or Division=ComboBox_Division.Selected
    And ComboBox_PrivateFederal.Selected=Blank() Or PrivateFederal=ComboBox_PrivateFederal.Selected
    And Dropdown_Active.Selected=Blank() Or Active=ComboBox_Active.Selected
)

 
You would have to change this to match your own control names and data types.

 

Or you could just take the simple route and change all of the DEFAULT properties for your dropdowns to 'All'.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

View solution in original post

Highlighted
Community Support
Community Support

Re: Selecting "All" or Specific item in Combobox OnStart

Hi @EmilyWinonaIT ,

Regarding the needs that you mentioned, I think it is not necessary to set up a collection to achieve your needs, it's complex. As an direct solution, you could add a extra "All" option to each ComboBox using the Concat function and Split function.

 

I have made a test on my side, please try the following workaround:

My Product Type Table data structure as below (only contains one column):

|  Type  |
|  ----- |
|  ERP   |
|  Dev   |
|  Test  |
|  Analyze |

The original options shown up inside the ComboBox as below:

8.JPG

 

If you want to add a "All" option to above ComboBox, please set the Items property to following:

Filter(
        Split(
                "All;" & Concat(ProductType, Type & ";"), 
                ";"
        ), 
        !IsBlank(Result)
)

9.JPG

then set the DefaultSelectedItems property of the ComboBox to following:

{
   Result: "All"    // Result represents the column name you used as Display column name in your ComboBox
}

you could try above solution, then apply same logic to other rest of ComboBox.

 

In addition, if you want to filter your Galley Items based on multiple ComboBox selections, please try the following formula:

Filter(
       'Your Data Source',
       If(
          IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
          true,
          Field1 = ComboBox1.Selected.Result
       ),
       If(
           IsBlank(ComboBox2.Selected.Result) || ComboBox2.Selected.Result = "All",
           true,
           Field2 = ComboBox2.Selected.Result
       ),
       ...
       ...
)

If you select "All" option within all ComboBoxes, the above Gallery would display "All" items without any filtering automatically, you do not need to set up a collection to store the filtered result, and bind it to the Gallery.

 

Please try above solution, hopes it could solve your problem.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Super User III
Super User III

Re: Selecting "All" or Specific item in Combobox OnStart

@EmilyWinonaIT 
I don't believe it is necessary to do all the work as @v-xida-msft is suggesting...  plus you said you did not want an ALL option.

When the filter is blank it can behave as an ALL option.  Just use a variation of my code and it will work.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Frequent Visitor

Re: Selecting "All" or Specific item in Combobox OnStart

OK I made a few corrections (mostly adding .Value) and it works...  a little.

However it seems to be ignoring the other filters and just filters based on the latest selected filter. I need it to show blanks if the three filters together do not product an active result. 

 

Filter(
'Marketing Catalog',
cbProductTag.Selected.Value = Blank() Or ProductTag1.Value = cbProductTag.Selected.Value
And cbDivision.Selected.Value = Blank() Or Division.Value = cbDivision.Selected.Value
And cbPrivateFederal.Selected.Value = Blank() Or 'Private/Federal'.Value = cbPrivateFederal.Selected.Value
And ddActive.Selected.Value ="Yes"
)

Highlighted
Frequent Visitor

Re: Selecting "All" or Specific item in Combobox OnStart

Ahh.. I figured out why it wasn't working right:

 

Filter(
'Marketing Catalog',
(cbProductTag.Selected.Value = Blank() Or ProductTag1.Value = cbProductTag.Selected.Value)
And (cbDivision.Selected.Value = Blank() Or Division.Value = cbDivision.Selected.Value)
And (cbPrivateFederal.Selected.Value = Blank() Or 'Private/Federal'.Value = cbPrivateFederal.Selected.Value)
And (ddActive.Selected.Value ="Yes")
)

 

The Or was throwing it off.

 

THANK YOU!!!

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,767)