Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Search Box Help!

(0) ShareShare
ReportReport
Posted on by 51

I recently had to relocate my sp list from one sp to another, and now my search function no longer works. The code will not work in any way I have tried it. 

 

This is the way it was working before:

 

Sort(Search('New Phone Book List',SearchBox.Text, "Emp Name", "Service", "Phone", "Title", "Keywords"),"Emp Name", Ascending)

 

The sort portion of the code is working, and the data will populate into the gallery when only this portion is input. 

Sort('New Phone Book List',"emp Name",Ascending)

 

When I try to put only the search function, no data will populate in the gallery.

 

I also tried it this way with no success:

Sort('New Phone Book List',"emp Name",Ascending);Search('New Phone Book List',SearchBox.Text,"Emp Name", "Service", "Phone", "Title", "Keywords")

 

Any advice? Thank you!

 

SShulaw_0-1669136499553.png

 

  • SShulaw Profile Picture
    SShulaw 51 on at
    Re: Search Box Help!

    Noted! Thanks for the help.

  • Drrickryp Profile Picture
    Drrickryp on at
    Re: Search Box Help!

    marty.jpg

     

  • SShulaw Profile Picture
    SShulaw 51 on at
    Re: Search Box Help!

    Thanks @Drrickryp , you earned your cape today!

  • Drrickryp Profile Picture
    Drrickryp on at
    Re: Search Box Help!

    @SShulaw 

    It depends on how many items are in your list.  If it will never exceed 2k, you can make a collection from the list and use that with the Search function or the "in" operator.  If it will exceed 2k, check @WarrenBelz 's blog Practical PowerApps for work arounds. 

    FYI: Name is a reserved word in PowerApps so never name a name column "name".

  • SShulaw Profile Picture
    SShulaw 51 on at
    Re: Search Box Help!

    Filter('New Phone Book', SearchBox.Text in 'Employee Name' || SearchBox.Text in Phone || SearchBox.Text in Keywords || SearchBox.Text in Title || SearchBox.Text in Service)

     

    Final Code

  • SShulaw Profile Picture
    SShulaw 51 on at
    Re: Search Box Help!

    So I got this to partially work. 

     

    Filter('New Phone Book', StartsWith(Title, SearchBox.Text) || StartsWith(Service, SearchBox.Text) || StartsWith('Employee Name',SearchBox.Text) || StartsWith(Phone,SearchBox.Text) || StartsWith(Keywords,SearchBox.Text))

     

    I had to change the name of my "Name" column (I know, rule 6). But there was another column named "Name {Name}" according to powerapps. So, that string above works however, not exactly how the original search string did. 

     

    Is it possible to make this search a partial match? i.e. it is currently finding John Smith if I type in John, but will not find him if I type in Smith because it is going off what the name (or number) starts with. 

  • SShulaw Profile Picture
    SShulaw 51 on at
    Re: Search Box Help!

    building a new list with the original names did not work either

  • Drrickryp Profile Picture
    Drrickryp on at
    Re: Search Box Help!

    @SShulaw 

    Changing it back may not work.  SharePoint "remembers" the original column names as well as the Display name that you change it to.  My suggestion is to start again with a new list, leave out spaces in the column names as well as the name of the list, Use only single line of text, numbers and data/time type columns.  Then import the data into the new list. Then, import the list into PowerApps. 

  • SShulaw Profile Picture
    SShulaw 51 on at
    Re: Search Box Help!

    I see.... Let me try to change that back and see what happens. 

  • Verified answer
    Drrickryp Profile Picture
    Drrickryp on at
    Re: Search Box Help!

    Hi @SShulaw 

    Welcome to SharePoint h3ll!  https://powerusers.microsoft.com/t5/Power-Apps-Community-Blog/The-Ten-Commandments-of-SharePoint-in-PowerApps/ba-p/848842 .  Check out #6

    In any event Search and "in" are not delegatable in SharePoint. For your problem, I suggest

    Filter('New Phone Book List', StartsWith(Title, SearchBox.Text) || StartsWith(Service, SearchBox.Text)....etc)

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard