web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter returns zero re...
Power Apps
Answered

Filter returns zero results when blank

(0) ShareShare
ReportReport
Posted on by 111

What part of the Filter function decides to show all results when a search box is blank? I get the results I want with this code:

 

SortByColumns(Filter(Events, TextSearchBox1_2.Text = MyAge), "EventDate", If(SortDescending1, Ascending, Descending))

But when the text search box is blank I don't get all results like I do with other galleries. All I need is for it to not filter when the search box is blank (Is Blank?)

 

Thanks.

Categories:
I have the same question (0)
  • v-micsh-msft Profile Picture
    on at

    Hi @RobRoy,

     

    You may consider switch to the Startswith function within the Filter.

    Take a try to change the formula as below:

    SortByColumns(Filter(Events, Startswith(MyAge, TextSearchBox1_2.Text)), "EventDate", If(SortDescending1, Ascending, Descending))

    The function reference:

    Startswith function in PowerApps

    If you have any further questions, please post back.

    Regards,

    Michael

  • RobRoy Profile Picture
    111 on at

    Thank you, I tried your suggestion.Unfortunately due to the nature of the search, I get all results for any age that starts with "3", for example (3, 30, 31, etc.), instead of only events that happened at the age of 3. Using the = MyAge formula does produce the correct result, however erasing the search box does not cancel the filter and restore the gallery, and instead produces a blank gallery (no results).

  • Verified answer
    m_takatsuka Profile Picture
    33 on at

    Hi

    You want to disable the Filter statement if the search box is blank?
    Then, how about so
      IF (ISblank (search box), sentence with filter, sentence without filter or datacource)

     

     

    I hope your expression will be solved.

     

  • RobRoy Profile Picture
    111 on at

    Thank you, that helped. I previously tried IsBlank but my syntax was off. I also had to rework the sort order to show records in descending order when the search box is blank. Here is the qworking code:

     

    If(IsBlank(TextSearchBox1_2.Text), Sort(Events, EventDate, If(SortDescending1, Ascending, Descending)), SortByColumns(Filter(Events, TextSearchBox1_2.Text = MyAge), "EventDate", If(SortDescending1, Ascending, Descending)))

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard