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

how to filter gallery when multiple checkboxes ticked

Hey all,

 

Below is my powerapp

Amber_L_0-1642984822372.png

The green boxes are the items I wish to filter and are displayed inside a gallery which is connected to a sharepoint list.

 

Currently, I have the gallery filtered to check the dropdown in the top left and filter based on the selection. Here is my formula on the 'Items'

Amber_L_1-1642985029896.png

 

The part I am now having trouble with is then filtering the gallery based on the checkboxes.

In the sharepoint list, I have one single line of text column labelled "Tags". This contains all the tags associated with that particular item. These 'tags' are the same as the checkboxes on the left of the screen. I essentially want the gallery to filter based on if that checkbox is ticked and if that tag is on that item.

 

Example:

I have 'Show All' selected in the drop down and I have three checkboxes ticked.

The result would be to show All Items that have either or all or some of those three checkboxes in the "Tags" column

 

Is this possible and if so how?

 

Thanks in advance!

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Amber_L :

Please try:

Filter(
    GalleryDataSource,
     If(CheckboxA.Value,CheckboxA.Text in Tags,true)&&
     If(CheckboxB.Value,CheckboxB.Text in Tags,true)&&
     If(CheckboxC.Value,CheckboxC.Text in Tags,true)&&
     If(CheckboxD.Value,CheckboxD.Text in Tags,true)&&    
     If(CheckboxE.Value,CheckboxE.Text in Tags,true)
)    
    

Best Regards,

Bof

View solution in original post

5 REPLIES 5
StalinPonnusamy
Super User
Super User

Hi @Amber_L 

 

The FIlter will be similar to this. 

 

 

Filter(
            SPList,
            Dropdown2.Selected.Value="Show All"  || Tags.Value in (Concat(Filter(
            Gallery1.AllItems, Checkbox2.Value = true ), Title & ","))
        )

 

 

My assumption is these checkboxes (s) are displayed within the Gallery


Thanks,
Stalin - Learn To Illuminate

v-bofeng-msft
Community Support
Community Support

Hi @Amber_L :

I've made a test for your reference:

1\I assume there is a table:

ClearCollect(GalleryDataSource,{Tags:"A,B"},{Tags:"A,B,D"},{Tags:"E"})

2\I assume there are 5 check boxes

vbofengmsft_0-1643088115877.png

You could filter the data in this way:

Filter(
    GalleryDataSource,
     If(CheckboxA.Value,CheckboxA.Text in Tags)||
     If(CheckboxB.Value,CheckboxB.Text in Tags)||
     If(CheckboxC.Value,CheckboxC.Text in Tags)||
     If(CheckboxD.Value,CheckboxD.Text in Tags)||    
     If(CheckboxE.Value,CheckboxE.Text in Tags)
)    

vbofengmsft_1-1643088151263.pngvbofengmsft_2-1643088159887.png

vbofengmsft_3-1643088169789.png

vbofengmsft_4-1643088180153.png

Best Regards,

Bof

 

 

hey! thanks for the help! I have that working now however I want to further filter it with the checkboxes. Best way is with an example:

Amber_L_0-1643137611005.png

The example above that you have done works well however by ticking checkbox B and checkbox D, it should only show results that have BOTH of those values. So if I tick checkbox B first it will show both of those results however once I select checkbox D, I want only result A,B,D as this is the only result that has both B and D in it.

 

Is this possible? I've tried so many ways and cant seem to get it to work.

 

Hi @Amber_L :

Please try:

Filter(
    GalleryDataSource,
     If(CheckboxA.Value,CheckboxA.Text in Tags,true)&&
     If(CheckboxB.Value,CheckboxB.Text in Tags,true)&&
     If(CheckboxC.Value,CheckboxC.Text in Tags,true)&&
     If(CheckboxD.Value,CheckboxD.Text in Tags,true)&&    
     If(CheckboxE.Value,CheckboxE.Text in Tags,true)
)    
    

Best Regards,

Bof

Perfect!!! I had that originally and it wasnt working but I forgot to put true at the end of each if statement! Thank you so much!

Helpful resources

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

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,571)