cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Instead of StartsWith, what about Contains

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Instead of StartsWith, what about Contains

Hi @cardinalpipkin, you can use the in operator

 

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

View solution in original post

7 REPLIES 7
Highlighted
Community Champion
Community Champion

Re: Instead of StartsWith, what about Contains

Hi @cardinalpipkin, you can use the in operator

 

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

View solution in original post

Highlighted
Helper V
Helper V

Re: Instead of StartsWith, what about Contains

That's great thanks.

Highlighted
Resolver I
Resolver I

Re: Instead of StartsWith, what about Contains

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!

Highlighted
Frequent Visitor

Re: Instead of StartsWith, what about Contains

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,

Highlighted
Resolver I
Resolver I

Re: Instead of StartsWith, what about Contains

Thanks - I will give it a try!

Highlighted
Regular Visitor

Re: Instead of StartsWith, what about Contains

Try search instead of filter

 

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

Highlighted
Anonymous
Not applicable

Re: Instead of StartsWith, what about Contains

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.

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (3,483)