cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
powerapps890
Post Prodigy
Post Prodigy

Show checked boxes with dropdown

I want to filter by a dropdown outside the gallery for a checked and unchecked checkboxes. Onvisible I have ClearCollect(Checked, "Checked", "Unchecked"); and the items for the dropdown is Checked. My issue is with the code for items in the gallery. I tried something like this If(
IsBlank(ComboBox1_1.Selected),
true,
Checkbox3.Value in ComboBox1_1.SelectedItems
)) but it didn't work. Is it possible to filter by checked to get the items to the top?

3 REPLIES 3
v-qiaqi-msft
Community Support
Community Support

Hi @powerapps890,

Based on the issue that you mentioned, do you want to filter the Gallery including Checkbox status based on the Combo Box selected?

Could you please tell me that if the Checkbox has corresponding column in your data source?

You want to filter the Gallery with all the Checked Checkbox once you select the "Checked" from the Combo Box, right?

I assume that you already have a column(named CK in my scenario) to store the Checkbox value.

If so, please try the following. In my scenario, Col1 is my data source.

Set the Items property as below:

If(
    IsBlank(ComboBox5.Selected) || IsEmpty(ComboBox5.Selected),
    Col1,
    Filter(
        Col1,
        CK = If(
            ComboBox5.Selected.Value = "Checked",
            true,
            false
        )
    )
)

If there is not a column in your data source to store the Checkbox value, I suggest you add another Gallery populated with a collection that created based on the previously Gallery all item.

Create a collection as below

ClearCollect(Col1,ShowColumns(AddColumns(Gallery10.AllItems,"CK",Checkbox3.Value),"CK","Code","Code_x0020_Description"))

Add a new Gallery and set the Items as :

If(
    IsBlank(ComboBox5.Selected) || IsEmpty(ComboBox5.Selected),
    Col1,
    Filter(
        Col1,
        CK = If(
            ComboBox5.Selected.Value = "Checked",
            true,
            false
        )
    )
)

Check if it could help you.

Regards,

Qi

 

Best Regards,
Qi

Capture.PNGYes,  that is what I want to do. I have a column in my datasource called CheckBoxColumn. I have this in my onvisible ClearCollect(Checked, "Checked", "Unchecked"); and on the combobox items I have Checked. This is how altered my gallery items 

If(
IsBlank(ComboBox1_4.Selected) || IsEmpty(ComboBox1_4.Selected),
Filter(
Sort(collCCBMasterData,LookUp(MyCollection,ID=collCCBMasterData[@ID]).TheCount),
If(
IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
'Functional Area' in ComboBox1.SelectedItems
) &&
If(
IsBlank(ComboBox1_1.Selected.Result) || ComboBox1_1.Selected.Result = "All",
true,
'Backlog Status' in ComboBox1_1.SelectedItems
) &&
If(
IsBlank(Filter.Text),
true,
Filter.Text in 'Requirement Source'
)&&
If(
IsBlank(Search_.Text),
true,
Search_.Text in Name), CheckBoxColumn = If(
ComboBox1_4.Selected.Value = "Checked",
true,
false
)
)
). Maybe I put your formula in wrong but the gallery is just blank there are no errors @v-qiaqi-msft 

Hi @powerapps890

That is so great that you have provided an error message, however it would be better if you could capture where cause the error because I do not know the data structure in your scenario.

In addition, could you please check my solution one more time? I use the following formula to check if there is selected item in my Combo Box:

IsBlank(ComboBox5.Selected) || IsEmpty(ComboBox5.Selected)

This is a completed formula to check if there is any selected item within the Combo Box.

I have found that there are so many other filter condition in your current formula that do not appear in your case description, I could not help you solve a problem that was suddenly exposed and never appeared before.

What's more, I want to explain to you that if you have cascading If statement, it will give priority to the first condition that is satisfied, and will not run after that.

Please remove other conditions and check if my formula work for the Checkbox, you could open a new case for other conditions and remember to provide more details.

Regards,

QI

Best Regards,
Qi

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,173)