cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft Employee

Contains Data Expression in Filtering a List

I am trying to filter my list before any search conditions are added.  In my Account source, I have some sample data I don’t want to show.  I can do that by applying a filter on the AccountNumber_ field.  So that the screenshot below only shows records where an Account Number contains data.  So Consolidate Messenger would be filtered out.

 

In looking at formulas at https://powerapps.microsoft.com/en-us/tutorials/add-gallery/, I have modified my formula to...

 

Sort(If(IsBlank(TextSearchBox1.Text), Account, Filter(Account, TextSearchBox1.Text in Text(OrganizationName))), OrganizationName, If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

 

I could change the logic to something like…

 

Sort(If(IsBlank(TextSearchBox1.Text), Filter(Account, AccountNumber_=”ACME1220”), Filter(Account, TextSearchBox1.Text in Text(OrganizationName))), OrganizationName, If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

 

However, I need to replace the equals statement to contains data.  Does anyone know what is the formula syntax to state only show records where AccountNumber_ contains data?

 

PowerApps List.png

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft Employee

Re: Contains Data Expression in Filtering a List

Very Close...  I had to make a few modifications, but that defintely helped.  Thanks.  Below is the finished statement.

 

Sort(
    If(
       IsBlank(TextSearchBox1.Text),
       Filter(Account, Not(IsBlank(AccountNumber_))),
       Filter(Account, Not(IsBlank(AccountNumber_)), TextSearchBox1.Text in Text(OrganizationName))),
   OrganizationName,
       If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

2 REPLIES 2
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Contains Data Expression in Filtering a List

You can use the !IsBlank expression (not IsBlank) to check whether a column contains data, so your formula would look something like this:

Sort(
    If(
        IsBlank(TextSearchBox1.Text),
        Filter(Account, !IsBlank(AccountNumber_))
        Filter(Account, !IsBlank(AccountNumber_), TextSearchBox1.Text in Text(OrganizationName))),
    OrganizationName,
    If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

Hope this helps!

Microsoft Employee

Re: Contains Data Expression in Filtering a List

Very Close...  I had to make a few modifications, but that defintely helped.  Thanks.  Below is the finished statement.

 

Sort(
    If(
       IsBlank(TextSearchBox1.Text),
       Filter(Account, Not(IsBlank(AccountNumber_))),
       Filter(Account, Not(IsBlank(AccountNumber_)), TextSearchBox1.Text in Text(OrganizationName))),
   OrganizationName,
       If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))