web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / search function only g...
Power Apps
Unanswered

search function only gives responses with the first name of title

(0) ShareShare
ReportReport
Posted on by 124

good day all!

 

I have an app that allows for searches through a gallery of a couple thousand entries of a sharepoint.  The below snip shows a couple of the boxes that they can put in to search.  The box that I am having the problem with is the 'title' box, as nearly every one of our titles are more than one word.  However, when you put anything in that box, it only searches the FIRST word of all of the titles and makes a match there.  Where should I be looking in order to change the code, so that it responds to ANY match?  Note:  I thought it might mean changing the 'startswith' to 'search' and that just broke things.

 

picture of boxes - 

davyjones_0-1662747596989.png

 

Code for the gallery - 

Table({Filter: "All"}, {Filter: "My requests"})

 

code for that box -

//Set(isLoading,true);

//Set(searchQuery,searchInput.Text);

//ClearCollect(collItems, SortByColumns(Filter('CV&S Intake Request',StartsWith("Title",searchQuery)),"Created_Date",Descending));

//Clear(bandItems);

//ForAll(collItems,

// Collect(bandItems,

// Last(FirstN(AddColumns(collItems,

// "RowIndex",

// CountRows(bandItems)+1

// ),

// CountRows(bandItems)+1

// )

// )

// )

//);

//Set(

// totalrecords,

// CountRows(bandItems)

//);

//Set(isLoading,false);

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @davyjones 

    Neither the Search() function or the "in" operator is delegatable in SharePoint, which means that only the first 2k items in your list will be searched.  If you can limit the list to less than 2k items, say by filtering by date, then you can use Search(yourfilteredlist, TextInput1.Text, "Title") to find text in any part of the Title field. 

  • davyjones Profile Picture
    124 on at

    Thank you for the idea!  However, I know that my sharepoint is already larger than 2000 items.  Additionally, i cannot filter anything prior to that 'title' check, so I am out of luck there too. 

     

    Any other workarounds that anyone might know?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @davyjones 

    If your list is not going to exceed 4k, you can create a collection and search it with Search() , from @WarrenBelz 's blog Practical PowerApps:

     

    With(
     {
     wLow: //gets the first 2k
     Sort(
     SPList,
     ID
     ),
     wHigh: //gets the last 2k
     Sort(
     SPList,
     ID,
     Descending
     )
     },
     ClearCollect( ///combines them and filters out the duplicates.
     colMyCollection,
     wLow,
     Filter(
     wHigh,
     !(ID in wLow.ID)
     )
     )
    )

     

     

     

    The resulting collection of >2k items is not subject to delegation but if the list is >4k, then the search can miss items.  (requires Setting>Row limit 2,000)

     

  • davyjones Profile Picture
    124 on at

    okay, sounds great!  Question though:  does your above code get put into the gallery and then the search is put in the box(es) in question?

     

    How should I modify the current code in the gallery (the part I included above) to jive with your suggestion?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @davyjones 

    Put the code in the OnVisible property of the screen to create the collection. Use the collection instead of the table. Search(collection, textinputX.Text), "Title") instead of StartsWith()

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard