cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Filter gallery through checkboxes

Hi there,

 

I have an issue with a gallery in PowerApps. The gallery displays items filtered from a SharePoint list column calles "Current Approval Status". At the moment the gallery displays the list items of three (out of seven) of the possible status values. 

 

The code I am using to do this is:

 

Sort(Filter('IT Project Approval Request';'Current Approval Status'.Value="Approved by IT Manager" Or
'Current Approval Status'.Value="Ready for examination" Or 'Current Approval Status'.Value="Ready for final decision");ID;Descending

 

I now want to filter the gallery by using three different checkoxes, displaying the different approval status possibilities.

So one Checkbox sorts by "Approved by IT Manager", the other by "Ready for examination" etc. and if two checkboxes are selected the respective items should be displayed.

 

Does anyone have an idea how to do that?

 

Dorothee

7 REPLIES 7
Highlighted
Super User III
Super User III

Hi @Anonymous ,

Using Approved, Examination and Decision as the names of your check boxes (change to your names) try this.

Sort(
   Filter(
      'IT Project Approval Request';
      If(
         Approved.Value=true;
         'Current Approval Status'.Value="Approved by IT Manager" &&
         Examination.Value=true;
         'Current Approval Status'.Value="Ready for examination" &&
         Decision.Value= true;
        'Current Approval Status'.Value="Ready for final decision"
      )
   );
   ID;
   Descending
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Anonymous
Not applicable

@WarrenBelz Thank you. 

 

How can I add that, if none of the boxes are selected I want to show all items with either of the three statuses?

 

(Like in my code -> 'IT Project Approval Request';'Current Approval Status'.Value="Approved by IT Manager" Or
'Current Approval Status'.Value="Ready for examination" Or 'Current Approval Status'.Value="Ready for final decision")

 

 

Highlighted

Ok @Anonymous ,

I provided a solution for your query - you did not mention this aspect. Your additional requirements could be met with something like - note I am trying to provide suggested structure - you may have to clean up the commas & brackets etc.

Sort(
   If(
      Approved.Value=false && Examination.Value=false && Decision.Value= false;
      'IT Project Approval Request';
       Filter(
         If(
            'IT Project Approval Request';
            Approved.Value=true;
            'Current Approval Status'.Value="Approved by IT Manager" &&
            Examination.Value=true;
            'Current Approval Status'.Value="Ready for examination" &&
            Decision.Value= true;
           'Current Approval Status'.Value="Ready for final decision"
         )
      )
   );
   ID;
   Descending
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Anonymous
Not applicable

@WarrenBelz Thanks, Warren. One more question: When I want to select 2 out of three checkboxes and filter the results in my gallery accordingly, how should I modify my code?

Highlighted

Hi @Anonymous ,
I used an && (and) separator - it should work in the current format.

Please let me know if it does not produce the results you want

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Anonymous
Not applicable

@WarrenBelz Unfortunately it doesn't. One I select multiple checkboxes, the gallery doesn't display any items at all.

 

I am using the following formula:


Filter(
'Datasource';
If(
Checkbox_1Value=true;
'Current Approval Status'.Value="Approved by IT Manager" &&
Checkbox_2.Value=true;
'Current Approval Status'.Value="Ready for examination" &&
Checkbox_3.Value=true;
'Current Approval Status'.Value="Ready for final decision";
'Current Approval Status'.Value="Approved by IT Manager" Or
'Current Approval Status'.Value="Ready for examination" Or
'Current Approval Status'.Value="Ready for final decision")
)

Highlighted

OK @Anonymous ,

I have a working solution that surprised me a bit. however if it is below - same principle as yours on a test list.

ThreeBoxFilter.gif

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Code is as follows

If(
   Approved.Value=false && Examination.Value=false && Decision.Value=false;
   'IT Project Approval Request';
   Filter(
      'IT Project Approval Request';
      If(
          Approved.Value=true;
          'Current Approval Status'.Value="Approved by IT Manager"
      ) ||
      If(
         Examination.Value=true;
         'Current Approval Status'.Value="Ready for examination"
      ) ||
      If(
         Decision.Value= true;
         'Current Approval Status'.Value="Ready for final decision"
      )
   )
)

 - you can add the Sort. 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,076)