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

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

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))

View solution in original post

2 REPLIES 2
CarlosFigueira
Power Apps
Power Apps

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!

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))

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,845)