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!
Noted! Thanks for the help.
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".
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
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.
building a new list with the original names did not work either
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.
I see.... Let me try to change that back and see what happens.
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)