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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / What to use instead of...
Power Apps
Answered

What to use instead of StartsWith to search entire box

(0) ShareShare
ReportReport
Posted on by 920 Super User 2024 Season 1

Hi,

I have this - 

 

StartsWith(Control_two.Value, 'search box'.Text) || StartsWith(ID_three, 'search box'.Text)

 

but this only searches for the first part of the string. How can I do a full Contains here?

 

Thanks

Categories:
I have the same question (0)
  • Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on at

    You can use the search function. 

     

    Search(sharepointlist,"text to search for","field to search in")

     

    Note the field name does go in quotes.

     

    The problem with this is that this is not delegable, so this will have issues with larger lists.

     

    Another way is to use in:

     

    Filter(sharepointlist,"text to search for" in fieldname)

     

    But again, also not delegable.

  • wonka1234 Profile Picture
    920 Super User 2024 Season 1 on at

    @Mike2500  thanks, how can I use it with my current setup? I have a search box i want to be able to use to search for both my fields.

  • Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on at

    Search supports multiple columns:

     

    Search(sharepointlist,"text to search for","field1","field2")

     

    or, for using it with the search box:

    Search(sharepointlist,txtSearch.Text,"field1","field2")
  • wonka1234 Profile Picture
    920 Super User 2024 Season 1 on at

    @Mike2500  getting error -

     

    wonka1234_0-1695655493594.png

     

  • Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on at

    What is control two? After "search box.text", the next item should be the name of the field, in quotes, that you want to search. Optionally, after that, you can put the name of a second field you want to search. 

     

    The delegation warning is expected. This will not work with larger datasets.

  • Chris-D Profile Picture
    1,246 on at

    What are you finding text in? Your code looks like a boolean statement, are you using this on a control, or to search a data source? 

  • wonka1234 Profile Picture
    920 Super User 2024 Season 1 on at

    @Chris-D @Mike2500  Control_two is a sharepoint list column. It is a choice column to be specific.

  • Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on at

    What data type is control_two?

  • wonka1234 Profile Picture
    920 Super User 2024 Season 1 on at

    @Mike2500  its a choice column. Is there another way to check?

  • Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on at

    Search is used to find text within a large block of text. If it's a choice, do you really need to search within the choice value?

     

    For example, if the choices are north, south, east, and west. Do you need to let the user find all choices with the letter "e"? Or are you looking for all list items that have west? I assume the latter? If so, use filter instead of search:

     

    Filter(sharepointlist,control_two.Value="West")

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard