cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dyaw-Drexel
Level: Powered On

Filtering Table Help

I have a table in my Power App - I am having issues trying to filter it. This is the current definition of the table:

 

SortByColumns(Filter('[dbo].[Tasks]',ID_Process='Processes Gallery'.Selected.ID_Process && If(FilterOn=true, Status=TaskStatus)),"Order")

That code is applying the first of many filters I'd like to use on the table. The problem is, if I set 

FilterOn=False

the table shows nothing at all. 

 

One solution that does not work is adding a Or statement as the DefaultResult value to the if statement. That won't work because while there are a finite number of TaskStatus values, when I get into filtering by things like username, there are an infinite amount of values. And PowerApps does not seem to have anything like a wildcard value to use in place. 

 

What could I be doing wrong here, or is there any ideas? Thanks!

1 REPLY 1
Super User
Super User

Re: Filtering Table Help

@dyaw-Drexel 

I would Filter the Tasks table like this.  Notice how if FilterOn is False then we use the criteria Status=Status?  That's how we get all criteria to match

 

SortByColumns(
Filter(
'[dbo].[Tasks]',
ID_Process='Processes Gallery'.Selected.ID_Process,
If(FilterOn=true, Status=TaskStatus, Status=Status)),
"Order"
)

 

To use multiple conditions you could do this...

 

SortByColumns(
    Filter(
        '[dbo].[Tasks]',
        ID_Process='Processes Gallery'.Selected.ID_Process,
        If(FilterOn=true, Status=TaskStatus, Status=Status),
If(FilterOn=true, Employee=your_ComboBoxName.DisplayName, Employee=Employee) "Order" )

 

Or maybe you want to get rid of the FilterOn variable completely...

 

SortByColumns(
    Filter(
        '[dbo].[Tasks]',
        ID_Process='Processes Gallery'.Selected.ID_Process,
        If(Status<>Blank(), Status=TaskStatus, Status=Status),
        If(Employee<>Blank(), Employee=your_ComboBoxName.DisplayName, Employee=Employee)
    "Order"
)

 

As you can see there are many ways to go here.  The more specific you can be about your situation the better I can tailor my response.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

 

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,782)