Skip to main content
Community site session details

Community site session details

Session Id : 9RVkFuE8jmIpV8yrgWmZKz
Power Apps - Building Power Apps
Answered

Adding a Search Bar to a Gallery

Like (0) ShareShare
ReportReport
Posted on 23 Feb 2021 11:28:34 by 136

Is it possible to add a Search Bar that can search all Data within the Gallery.

For instance, if I search 'Open' it would provide me with listings of any item that has the word Open within it?

Categories:
  • rroque Profile Picture
    350 on 05 Jun 2024 at 11:44:28
    Re: Adding a Search Bar to a Gallery

    Good morning Warren. This sample works perfectly thank you so much for your help.  

  • Verified answer
    WarrenBelz Profile Picture
    148,805 Most Valuable Professional on 04 Jun 2024 at 21:24:19
    Re: Adding a Search Bar to a Gallery

    @rroque ,

    Should be like this - assuming ctx_sort_column is a Variable.

    SortByColumns(
     Search(
     OPTrack_FormsInventoryEnhancedTables,
     txtSearch.Text, 
     FORM_NO
     ),
     ctx_sort_column,
     If(
     ctx_sort_order,
     SortOrder.Ascending,
     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

     

  • rroque Profile Picture
    350 on 04 Jun 2024 at 21:20:25
    Re: Adding a Search Bar to a Gallery

    I'm not sure I know what posting it together means.  The two pieces of code is what I'm using now. I added the code to the items property of my list.  

  • rroque Profile Picture
    350 on 04 Jun 2024 at 21:19:09
    Re: Adding a Search Bar to a Gallery

    I'm not sure I know what posting it together means.  The two pieces of code is what I'm using now. I added the code to the items property of my list.  

  • rroque Profile Picture
    350 on 04 Jun 2024 at 21:13:12
    Re: Adding a Search Bar to a Gallery

    Warren, here the commented code sorts the columns and the search below it.  Both code I have in the items property of my list.   So at the moment I can do one or the other but not both.  By putting the code in the items property the second one types something in the search box the search kicks off and tries to find whatever is typed in the search box. I really like this behavior. 

    /*
    SortByColumns(
    OPTrack_FormsInventoryEnhancedTables,
    ctx_sort_column,
    If(
    ctx_sort_order,
    SortOrder.Ascending,
    SortOrder.Descending
    )
    )
    */
    Search(OPTrack_FormsInventoryEnhancedTables, txtSearch.Text, FORM_NO)

  • WarrenBelz Profile Picture
    148,805 Most Valuable Professional on 04 Jun 2024 at 21:08:05
    Re: Adding a Search Bar to a Gallery

    @rroque ,

    Posting it all together would be much better.

  • WarrenBelz Profile Picture
    148,805 Most Valuable Professional on 04 Jun 2024 at 21:08:03
    Re: Adding a Search Bar to a Gallery

    @rroque ,

    Posting it all together would be much better.

  • rroque Profile Picture
    350 on 04 Jun 2024 at 20:58:06
    Re: Adding a Search Bar to a Gallery

    Kevtun. Take a look at my code below you'll find what you're looking for.

  • WarrenBelz Profile Picture
    148,805 Most Valuable Professional on 04 Jun 2024 at 20:57:50
    Re: Adding a Search Bar to a Gallery

    Hi @rroque ,

    Can you please post the code you attempted with both functions.

  • rroque Profile Picture
    350 on 04 Jun 2024 at 20:13:12
    Re: Adding a Search Bar to a Gallery

    Hi Warren. Because I added sort capable columns to the list items property the search function no longer works. So it's sort or search but not both.  Any help would be greatly appreciated. 

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1

Loading complete