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

Filter gallery with multiple checkboxes

usingHello guys, how are you?

 

I am getting better improvement in Powerapps, but still having some difficulties to implement the right solution.

I have one gallery control from Sharepoint List, with a searchbox and 8 different checkboxes : I want to filter my gallery control according to checked check boxes.

My problem is :

If I select only one checkbox (that means checkbox1 =Engineering) then gallery should have only "Engineering" records and if I select 2 checkboxes (checkbox1 =Engineering and checkbox2 =Proposal), then the gallery would have Engineering and Proposal data and so on> if I have 5 checkboxes checked, I shall see 5 data in the gallery. but it is not working, only one data is displayed.

>>  what I want is to be able to have all data included in display regarding the number of checked check boxes.

Here is the formula that I have put in the items section of the gallery :

 

If(

CheckboxEngineering_1.Value; Search( Filter('TI Tools Library';Titre="Engineering"); ToolSearchBox3_1.Text; "Tool") ;
CheckboxDBOffice_1.Value; Search(Filter('TI Tools Library';Titre="DB Office"); ToolSearchBox3_1.Text; "Tool") ;
CheckboxConstructCommiss_1.Value; Search( Filter('TI Tools Library';Titre="Construction & Commissioning"); ToolSearchBox3_1.Text; "Tool") ;
CheckboxFinancePerformance_1.Value; Search(Filter('TI Tools Library';Titre="Finance & Performance"); ToolSearchBox3_1.Text; "Tool") ;
CheckboxMarketing_1.Value; Search(Filter('TI Tools Library';Titre="Marketing"); ToolSearchBox3_1.Text; "Tool") ;
CheckboxProposal_1.Value; Search(Filter('TI Tools Library';Titre="Proposal"); ToolSearchBox3_1.Text; "Tool") ;
CheckboxDTI_1.Value; Search(Filter('TI Tools Library';Titre="DTI"); ToolSearchBox3_1.Text; "Tool") ;
CheckboxSCPM_1.Value; Search( Filter('TI Tools Library';Titre="SCPM"); ToolSearchBox3_1.Text; "Tool") ;

Search('TI Tools Library'; ToolSearchBox3_1.Text; "Tool")

)

 

Besides, I have tried to do with CountIf but it doesn't work.

 

Please advise

Many thanks

3 REPLIES 3
v-yutliu-msft
Community Support
Community Support

Hi @Mansoor88 ,

Do you want to filter items by using some checkboxes and a textinput?

Is Titre field and Tool field both text type?

If so, try this:

1)set checkboxes

set CheckboxEngineering_1's OnCheck:

Set(var1,true)

 set CheckboxEngineering_1's OnUncheck:

Set(var1,false)

set CheckboxDBOffice_1's OnCheck:

 

Set(var2,true)

 

 set CheckboxDBOffice_1's OnUncheck:

 

Set(var2,false)

 

.....

Please set 8 check boxes like these two check boxes. (set var1,var2,var3,var4,var5,var6,var7,var8)

2)set the gallery's Items:

If(IsBlank(ToolSearchBox3_1.Text),
   'TI Tools Library'),
   If((IsBlank(var1)&&IsBlank(var2)&&IsBlank(var3)&&IsBlank(var4)&&
       IsBlank(var5)&&IsBlank(var6)&&IsBlank(var7)&&IsBlank(var8))||
      (!var1&&!var2&&!var3&&!var4&&!var5&&!var6&&!var7&&!var8),
      Search('TI Tools Library', ToolSearchBox3_1.Text, "Tool"),
      Filter(Search('TI Tools Library',ToolSearchBox3_1.Text,"Tool"),
        If(var1,Title="Engineering")||If(var2,Title="DB Office")||If(var3,Title="Construction & Commissioning")|| If(var4,Title="Finance & Performance")||If(var5,Title="DMarketing")||If(var6,Title="Proposal")|| If(var7,Title="DTI")||If(var8,Title="SCPM")
              )
       )
)

Then, if there's no checkbox checked and there's no word in the textinput, the gallery will display all the items.

If there's no checkbox checked and there's word in the textinput, the gallery will filter data based on the textinput.

If there's checkbox checked, the gallery will filter based on the check boxes and the textinput.

What's more, I've noticed that you use ";" as "," in your region. So you may try these formulas:

Set(var1;true)
Set(var1;false)
If(IsBlank(ToolSearchBox3_1.Text);
   'TI Tools Library');
   If((IsBlank(var1)&&IsBlank(var2)&&IsBlank(var3)&&IsBlank(var4)&&
       IsBlank(var5)&&IsBlank(var6)&&IsBlank(var7)&&IsBlank(var8))||
      (!var1&&!var2&&!var3&&!var4&&!var5&&!var6&&!var7&&!var8);
      Search('TI Tools Library'; ToolSearchBox3_1.Text; "Tool");
      Filter(Search('TI Tools Library';ToolSearchBox3_1.Text;"Tool");
        If(var1;Title="Engineering")||If(var2;Title="DB Office")||If(var3;Title="Construction & Commissioning")|| If(var4;Title="Finance & Performance")||If(var5;Title="DMarketing")||If(var6;Title="Proposal")|| If(var7;Title="DTI")||If(var8;Title="SCPM")
              )
       )
)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Phoebe Liu 

 

Thank you very for your help,

 

I tried to implement with your formula, by setting first the checkboxes (OnCheck & OnUncheck)

 

unfortunately, it is working.

 

Best regards, Mansoor88

Any other solution

 

Thanks

Helpful resources

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