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 / Instead of StartsWith,...
Power Apps
Answered

Instead of StartsWith, what about Contains

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am modifying an out of the box search field which then filters the gallery. The data is imported by an SPO data connection (list).

 

In the gallery I have:

 

SortByColumns(Filter(ControlRoomContacts, StartsWith(Title, TextSearchBox1.Text)), "COMPANY", If(SortDescending1, Descending, Ascending))

 

So the StartsWith function then looks within the Title field but it only looks for a search that starts with. For example:

If someone searches for  Library, it will only find something in the Title field that STARTS WITH library. What if I want it to search in the title field for something like Cafe Library instead?

 

Categories:
I have the same question (0)
  • Verified answer
    Meneghino Profile Picture
    6,949 on at

    Hi @Anonymous, you can use the in operator

     

    This operator is not yet delegated for SP lists so you will only query the first 500 records

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    That's great thanks.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi - I would very much appreciate an example of this solution, where the suggestion is to replace "StartsWith" with the "in" Operator. In my example:

    SortByColumns(Filter('DataSource', StartsWith(FieldName000, TextSearchBox1.Text)), "FieldName000", If(SortDescending1, Descending, Ascending))

    How would I correctly replace "StartsWith" with the "in" Operator, so that using this expression searches the whole of FieldName000 for any input entered in TextSearchBox1.Text - instead of it only checking the Start of the Field for a match?

    Thanks!

  • rabiawilliams Profile Picture
    14 on at

    Hey there check this sample code to replace StartsWith with in

     

    ClearCollect(Contacts, SortByColumns(Filter(Office365.ContactGetItems(DropdownContact.Selected.Value).value, TextInputSearchContact.Text in DisplayName), "DisplayName"))

    Cheers,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks - I will give it a try!

  • SoorajDathan Profile Picture
    7 on at

    Try search instead of filter

     

    SortByColumns(Search(ControlRoomContacts,  TextSearchBox1.Text, Title)), "COMPANY", If(SortDescending1, Descending, Ascending))

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi,

     I am looking for a little help.  I have a gallery and it is working as it is meant to, however, i kinda need it not to work as it should.  What i need is for it not to show all the list from the search (filter)  What i need is to enter the employee number at the search and not to show everyone when the box  is empty.  i need it to only show the person who's number is typed in after it is typed in.  This is the code i have on the Items:

    Filter(Employees, StartsWith(Cal, TextSearchBox1_1.Text))

     

    Any help would be great.

  • sharathgn Profile Picture
    2 on at

    Hi you can simply use default text function in search bar. Insert default text "Enter employee ID" so that it won't display any result.

     

    • There might be many other ways but this is the easiest one I feel.
  • CullumGiles Profile Picture
    on at

    The below works for me in a Wiki App which I developed where Wiki List is the SharePoint list name and Title is the field to be searched.

     

    Within the Browse Screen, Select Browse Gallery and in formula bar Items = Search('Wiki List', TextSearchBox1.Text, "Title")

     

    You may be prompted with a delegation warning regarding limitations on use of search with (SharePoint) datasets exceeding a 500 record limit, so this is currently only a viable solution with smaller datasets.

  • Fili Profile Picture
    4 on at

    For anyone still looking in years to come the below is what I did to make it work!

    SortByColumns(Filter([@WrikeWiki], TextSearchBox1.Text in Text(Title)), "Title", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard