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

Filtering with Multiple Checkboxes

Hi everyone, 

 

So i have sharepoint list with some project info in it, one of the tables is called Status, in it I have, On Hold, Ongoing and Completed.

In my power app, i'm using a gallery and I'm trying to filter using checkboxes with the same Status name, but I have a problem.

 

Firstly Here's my code so far, its currently missing code for the Completed checkbox:

 

Filter('ProjectDetails', (Status.Value = (If(chkOnHold.Value,"On Hold","Ongoing"))) Or (Status.Value = (If(chkOngoing.Value,"Ongoing","On Hold"))))

 

 

The problem think i cant figure out how to get is my Else to show all my projects in the gallery, right now if i check "On Hold" i get the projects that are On Hold, and if i uncheck it i get all the projects that are On Hold and Ongoing but not Completed, same for the Ongoing checkbox and if i check both On Hold and Ongoing i get both.

 

Basically what i'm looking for is this:

When the app loads and all boxed are not checked, all projects are displayed. And when i check any box or combination of boxes i i get the associated projects.

 

Any ideas, thanks

7 REPLIES 7
eka24
Super User
Super User

Is it possible to replace the textboxes with a combobox?

Combobox Items: Choices(Datasource.Satus.Value)

 

Then filter as:

Filter(ProjectDatails, Status.Value in Combobox.Selected.Status)

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

RustyAdmin
Frequent Visitor

it could, but i was trying to see if and how it could be done, for learning purposes 🙂

Your formula does not include complete criteria:

Filter('ProjectDetails',
(Status.Value = (If(chkOnHold.Value,"On Hold","Ongoing"))) Or (Status.Value = (If(chkOngoing.Value,"Ongoing","On Hold"))) Or (If(chkComplete.Value,"Complete","Completed"))))

 

Or

 

If(chkOnHold.Value,
Filter(ProjectDatails,Status.Value ="On Hold") Or
If(chkOngoing.Value,
Filter(ProjectDatails,Status.Value ="Ongoing") Or
If(chkComplete.Value,
Filter(ProjectDatails,Status.Value ="Complete"))))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

RustyAdmin
Frequent Visitor

Hi eka24,

 

The second option looks closer to what I'm trying to achieve but it isn't working and if I just ran the first portion, it would leave my app blank until I checked the box.

 

If(chkOnHold.Value,
Filter(ProjectDetails,Status.Value ="On Hold")

 

Changing it to the following would give the correct result but I suspect that won't work as easily for the entire thing.

If(chkOnHold.Value,
Filter(ProjectDetails,Status.Value ="On Hold"), ProjectDetails)

 

With regards to option 2 not working, I'm getting the following error when i use what you provided:

Invalid Argument Type: Expected one of the following: Boolean, Number, Text, OptionSetValue.

Expected Table Value.

 

Any idea whats causing this?

Follow this approach which I have tested:

1. On OnCheck of  chkComplete CheckBox

Collect(ColStatus,"Complete")
OnUnCheck
Remove( ColStatus,First( Filter( ColStatus, Value="Complete" ) ) )
 

2. On OnCheck of  chkOngoing CheckBox

Collect(ColStatus,"Ongoing")
OnUnCheck
Remove( ColStatus,First( Filter( ColStatus, Value="Ongoing" ) ) )
 

3. On OnCheck of  chkOnHold CheckBox

Collect(ColStatus,"On Hold")
OnUnCheck
Remove( ColStatus,First( Filter( ColStatus, Value="On Hold" ) ) )
 
4. Filter as Follows:
Filter(ProjectDatails,Status in ColStatus.Value)
OR
Filter(ProjectDatails,Status.Value in ColStatus.Value)
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
RustyAdmin
Frequent Visitor

Hi eka24 I'm getting a problem with the last the Filter at #4.  Because im using a sharepoint list, It seems the 'in' is not delegable, is there any way around this? Thanks

Then create a collection Onvisible of the screen:

ClearCollect (MyProject, ProjectDatails)

 

Change the formula on #4 to;

4. Filter as Follows:
Filter(MyProject,Status in ColStatus.Value)
OR
Filter(MyProject,Status.Value in ColStatus.Value)
 
If you have issues, give a screenshot
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (4,461)