Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

What to use instead of StartsWith to search entire box

(0) ShareShare
ReportReport
Posted on by 909 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

  • Verified answer
    Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on at
    Re: What to use instead of StartsWith to search entire box

    Ok, so you are trying to do a search within a choice value. That's a little unusual, but we can get it to work:

     

    Search(AddColumns(sharepointlist,"choicevalue",column_two.Value), TextSearchBox1.Text,"ID_three","choicevalue")

     

    Search only works on text fields, not choice fields. So, the above adds a column to the list in powerapps. the column is named "choicevalue", though the column name doesn't really matter. What matters is that you reference that same column name in the later argument. So, after the column is added, the result of addcolumns is used by search. Search is looking for the contents of the textbox in any location of the following two fields: id_three and chocievalue. 

     

  • wonka1234 Profile Picture
    909 Super User 2024 Season 1 on at
    Re: What to use instead of StartsWith to search entire box

    @Mike2500 

     

    Full code for browsegallery items property -

     

    SortByColumns(
     Filter(
     Filter(
     [@'Data Source'],
     Lower(User().Email) = "email@gmail.com" //Requestor can only see their own requests 
     ),
     StartsWith(Control_two.Value, 'search box'.Text) || StartsWith(ID_three, 'search box'.Text) 
     ),
     "Title",
     If(
     SortDescending1,
     SortOrder.Descending,
     SortOrder.Ascending
     )
    )

     

    both ID_three and Control_two.value both exist in my gallery/sp list.

     

    How can I search for them using my "search box". I dont want to search for beggining, I want to find ANY letters in either of these two fields.

     

    ID_three is  a single line of text and control_two.value is a choice.

     

    How can I alter my current code so I can search for any values with these two fields, could be beginning middle or end.

  • Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on at
    Re: What to use instead of StartsWith to search entire box

    Does the filter not work for you? If not please provide specific examples of what you're trying to accomlish.

  • wonka1234 Profile Picture
    909 Super User 2024 Season 1 on at
    Re: What to use instead of StartsWith to search entire box

    i need to be able to filter my browsegallery by control_two column values.

  • Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on at
    Re: What to use instead of StartsWith to search entire box

    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")

     

     

  • wonka1234 Profile Picture
    909 Super User 2024 Season 1 on at
    Re: What to use instead of StartsWith to search entire box

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

  • Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on at
    Re: What to use instead of StartsWith to search entire box

    What data type is control_two?

  • wonka1234 Profile Picture
    909 Super User 2024 Season 1 on at
    Re: What to use instead of StartsWith to search entire box

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

  • Chris-D Profile Picture
    1,246 on at
    Re: What to use instead of StartsWith to search entire box

    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? 

  • Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on at
    Re: What to use instead of StartsWith to search entire box

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,635 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard