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 / help with filters and ...
Power Apps
Unanswered

help with filters and empty fields

(0) ShareShare
ReportReport
Posted on by

say I have 3 dropdown and 1 text field.  I need to filter the data by these inputs.

 

if I do this code below, with && I get specific results, which I like, but this filters all the dropdowns regardless if they are blank/empty and does not provide good results.  If I use && and populate all the inputs it works great giving me specific results.  I tried || and this provides way too many results and they do not look accurate at all.  

I tried doing If statements inside this code to like not search one of these if they are blank/empty, but I keep getting errors.

What is my best approach to exclude searches if those fields are empty.  Should I be creating big If statements to provide the filter based on empty fields.  cause that will be a very big nested if/else I would like to avoid...

 

SortByColumns(
 Filter(
 //Filter('PSI - PROJECTS', Dropdown_region.SelectedText.Value in region.Value || Dropdown_location.SelectedText.Value in location.Value || Dropdown_l1sponsor.SelectedText.Value in l1_sponsor.Value )
 Filter('PSI - PROJECTS', Dropdown_location.SelectedText.Value in location.Value && Dropdown_l1sponsor.SelectedText.Value in l1_sponsor.Value && Dropdown_region.SelectedText.Value in region.Value)
 ,
 search_title_code.Text in Title || search_title_code.Text in project_code || search_title_code.Text in acronym
 ), 
 "Title",
 SortOrder.Descending
)
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @gstlouis ,

    I think this is what you are trying to do

    SortByColumns(
     Filter(
     'PSI - PROJECTS', 
     (
     Len(Dropdown_region.Selected.Value) = 0 ||
     Dropdown_region.Selected.Value in region.Value
     ) &&
     (
     Len(Dropdown_location.Selected.Value) = 0 ||
     Dropdown_location.Selected.Value in location.Value
     ) &&
     (
     Len(Dropdown_l1sponsor.Selected.Value) = 0 ||
     Dropdown_l1sponsor.Selected.Value in l1_sponsor.Value 
     ) &&
     (
     Len(search_title_code.Text) = 0 ||
     search_title_code.Text in Title || 
     search_title_code.Text in project_code || 
     search_title_code.Text in acronym
     )
     ),
     "Title",
     SortOrder.Descending
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • gstlouis Profile Picture
    on at

    Thanks for this.  It looks to be working.  So between the parenthesis creates like a ternary if stmt?  If this input = 0 nothing happens, else search input in table?

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @gstlouis ,

    Correct - I use Len (length) as it covers both IsBlank() and IsEmpty() so Len(ControlOutput) = 0 means there is nothing in there and if this is true, no filter is applied.

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard