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 / Filtering A Gallery By...
Power Apps
Answered

Filtering A Gallery By A Wildcard

(0) ShareShare
ReportReport
Posted on by 71

Hey everyone,
I have a gallery with 7 fields in it.  I want to be able to filter it by the 7 fields.  One of the fields is a dropdown, and the others are all text inputs.  I will be adding an 8th field soon(it will be a checkbox).  

Also, I want it to be that when the fields are blank, it still filters the gallery but by a wildcard.  That wildcard will mean "anything".  My first thought was using an If statement.  

Ex: If('Input-TypeOfChange.Text' in Title, StartsWith(Title, 'Input-TypeOfChange.Text') . . .  The ellipses at the end is because I didn't finish it.  (I know this formula is all wrong, but just bear with me)

My question:  How can I create a way to filter my gallery in the easiest, and most simplest, way possible.  

Thanks guys.

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @FranzCarson3 

    Keep it simple and avoid the If statements!

    Just build your filter around the conditions you want.  Don't worry about the concept of a "Wildcard" if the search is blank.

    If you have a textinput for search for, let's say the Title column, then this formula:

       Filter(yourDataSource, StartsWith(Title, txtInputSearch.Text))

    will result in all rows if the text is blank and if not, then only rows that start with the value in the search.

     

    I hope this is helpful for you and what you were meaning.

  • LRVinNC Profile Picture
    2,297 on at

    Here's a example where I have a bank of 11 possible filters in which the user can use none or all 11.  Here's a excerpt from the filter for the gallery.  (The full logic repeats portions of this set of criteria depending on some other variables - this is one complete set of criteria).

    FilterExample.jpg

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @FranzCarson3 

    Like @RandyHayes says but to make sure that your dropdown includes a blank value please see https://powerusers.microsoft.com/t5/Building-Power-Apps/Need-Dropdown-with-blank-null-default/td-p/58172  for a discussion as to how to make a dropdown control show a blank value by default.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Drrickryp    or if you want to avoid putting blank and default "All" items in your data source, then watch this video on how to do it dynamically.

  • FranzCarson3 Profile Picture
    71 on at

    Hey,
    I tried this and it worked.  But now my question is how do I add multiple fields to it?
    And I forgot to mention that 3 of my fields are date pickers.

    Thanks

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @FranzCarson3 

    Can you describe what you tried?  You have three different responses to your post.  Mine, @Drrickryp 's or @LRVinNC 's ?

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @FranzCarson3 

    Oh, and if it was mine that you were referring to, then you can utilize the following:

       Filter(yourDataSource,

               StartsWith(Title, txtInputSearch.Text) ||

               StartsWith(anotherColumn, txtInputSearch.Text) ||

              ...etc...

       )

  • FranzCarson3 Profile Picture
    71 on at

    @RandyHayes 
    I tried this out, and it doesn't seem to filter the gallery at all.
    Filter(
    'Invoice Activities - No Opportunities',
    StartsWith(
    Title,
    'Imput-TypeOfChangeFilterImput'.Text
    ) || StartsWith(
    'Customer Name',
    'Imput-CustomerNameFilterImput'.Text
    ) || 'Drop-SignedAgreementFilterDropdown'.Selected.Value = 'Signed Agreement'.Value || 'Date-DateRequestedFilterDatePicker'.SelectedDate = 'Date Requested' || 'Date-ReadyToInvoiceFilterDatePicker'.SelectedDate = 'Ready To Invoice' || 'Date-Invoice/ReturnDateFilterDatePicker'.SelectedDate = 'Invoice/Return Date' || StartsWith(
    Notes,
    'Imput-NotesFilterImput'.Text
    )
    )

    I have this.  I just want to make sure that this is what you meant.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @FranzCarson3 

    Yes, you are on the right track.  I would suspect you are having problems from the Dates.  So, change your formula to the following and see if it returns results as expected:

    Filter(
     'Invoice Activities - No Opportunities',
     StartsWith(Title, 'Imput-TypeOfChangeFilterImput'.Text) || 
     StartsWith('Customer Name', 'Imput-CustomerNameFilterImput'.Text) || 
     StartsWith(Notes,'Imput-NotesFilterImput'.Text
     )
    )

    Then we can expand from there. 

  • FranzCarson3 Profile Picture
    71 on at

    @RandyHayes,
    I have it changed, and it worked the first time I did it, but it just stopped working.  Here's what my app looks like:

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