Skip to main content

Notifications

Community site session details
Power Apps - Building Power Apps
Answered

Unable to Search through data set in Gallery - No results

Like (0) ShareShare
ReportReport
Posted on 18 Apr 2024 02:39:45 by 30

Hi all, 

 

Thanks ahead of time for your help. I've been trying to make a very simple app to learn the basics of MPAs, but I cant seem to be able to find a way to search through my data. I've already spent some time searching through other people's posts and despite implementing some changes I still am stuck.

 

As shown in the images attached, I have a search bar as a text input feeding into the Search() command for a Gallery. The current formula in my Items line for the gallery is the following: 

Search(Table3, SearchInput1.Text,"PO Number")
Here, Table3 is the name of the imported table from Excel, and PO Number is the name of the column in the excel Im trying to search through. Later I want to add the ability to search through multiple columns, such as searching by the Plant number or Part Description, as pictured.
 
Any and all advice is appreciated
Categories:
  • WarrenBelz Profile Picture
    146,947 Most Valuable Professional on 19 Apr 2024 at 09:03:18
    Re: Unable to Search through data set in Gallery - No results

    Hi @chrislamb2012 ,

    You cannot refer to column names dynamically unfortunately.

  • chrislamb2012 Profile Picture
    30 on 19 Apr 2024 at 08:16:07
    Re: Unable to Search through data set in Gallery - No results

    Hi @WarrenBelz,

     

    Would you be willing to assist me with another issue attached to your Solution?

     

    I am now trying to use a drop-down selection output as an input for the desired search column argument in the Search() function. The Drop Down options are pulling from a column in my dataset with the name "Title Column" which has the names of all my other Columns in it. I'll attach an image of the column incase its format is relevant. I know its not very elegant, but it gets the job done for now while I learn.

     

    I've modified your line of code into the following:

     
    With( {_Data: MnSTable}, Search( _Data, SearchInput1.Text, Dropdown1.SelectedText.Value))
     
    At first I thought this or wrapping the Dropdown1 var in Text() would work, but MPAs keeps stating that argument "Dropdown1.SelectedText.Value" expects a literal so I tried reading around online but found no solutions.
     
    Thanks again for your help yesterday
  • WarrenBelz Profile Picture
    146,947 Most Valuable Professional on 18 Apr 2024 at 06:29:11
    Re: Unable to Search through data set in Gallery - No results

    Hi @chrislamb2012 ,

    Excel is a terrible data source where code that should work simply does not and this is yet another example. It clearly did not respond to your query (it should have sent the list back as the query is not Delegable), so I used a With() statement to "do it manually" and load the entire table, then do the query entirely "locally". This will only work on record numbers up to your Data Row Limit (which you can increase to a maximum of 2,000). I suggest you migrate to SharePoint Lists if you have them available.

  • chrislamb2012 Profile Picture
    30 on 18 Apr 2024 at 06:24:07
    Re: Unable to Search through data set in Gallery - No results

    @WarrenBelz That worked perfectly, thank you!

    Would you mind explaining the line a bit?

  • Verified answer
    WarrenBelz Profile Picture
    146,947 Most Valuable Professional on 18 Apr 2024 at 03:56:30
    Re: Unable to Search through data set in Gallery - No results

    Hi @chrislamb2012 ,

    How many records are in your Table - if under 500, try this for a test

    With(
     {_Data: Table3},
     Search(
     _Data,
     SearchInput1.Text,
     "PO Number"
     )
    )

     

    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

  • chrislamb2012 Profile Picture
    30 on 18 Apr 2024 at 03:48:57
    Re: Unable to Search through data set in Gallery - No results

    hmm alright, maybe its my excel table then. Ill try reformatting it. Thanks again

  • stum Profile Picture
    41 on 18 Apr 2024 at 03:40:34
    Re: Unable to Search through data set in Gallery - No results

    I have a gallery and I use the same logic in gallery's Item property to filter orders as the user type and works without any issues. 

  • chrislamb2012 Profile Picture
    30 on 18 Apr 2024 at 03:24:13
    Re: Unable to Search through data set in Gallery - No results

    Hi @WarrenBelz , I've tried your idea but unfortunately landed into a new issue. Now I cannot see the Gallery thats been moved as seen in my attached image. I tried messing around with some things and searching through multiple threads I found on google, but no dice.

     

    EDIT: Scratch that, I was able to figure out the issue, but the search still reveals no results with partial or complete search terms. Any further ideas?

     

    Any suggestions? Thanks for your help

  • chrislamb2012 Profile Picture
    30 on 18 Apr 2024 at 03:22:46
    Re: Unable to Search through data set in Gallery - No results

    Hi @stum, Unfortunately this did not change anything, as the search does not reveal any results with Partial or Complete PO Numbers. Is there anything else you'd reccomend?

  • stum Profile Picture
    41 on 18 Apr 2024 at 03:18:12
    Re: Unable to Search through data set in Gallery - No results

    Instead of Search function you can use Filter function in Items property of your gallery. This will dynamically filter results in gallery.

     

     

    Filter(
     'Table 3',
     StartsWith(
     'PO Number',
     SearchInput1.Text
     )
    )

     

     

    And for additional columns you can expand the formula like this.

     

    Filter(
     'Table 3',
     StartsWith(
     'PO Number',
     SearchInput1.Text
     ) && CustomerNumber.Value = CustomerNumberDropdown.Selected.Value
    )

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 60

#3
stampcoin Profile Picture

stampcoin 48

Overall leaderboard