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 / Startwith and Search f...
Power Apps
Answered

Startwith and Search function - not working

(0) ShareShare
ReportReport
Posted on by 76

Hi and thank you in advance for helping me...

 

I have the following code and it works great. But I would like to switch the StartsWith with just a "Search" function. 

I feel I have tried everything, but nothing is working. Not sure if it's syntax, order or something in between.  Any suggestions?

Data Source - 'CPAR Tracker'

text input field- txtSearch_Number

text input field - txtSearch_Subject

 

This works.........

Filter(
'CPAR Tracker',

IsBlank(Text(txtSearch_Number))||Text(txtSearch_Number)= 'CPAR Number',
StartsWith( Subject, txtSearch_Subject.Text)

)

 

Categories:
  • EddieE Profile Picture
    4,650 Moderator on at

    @Sadiejane 

    Try this

    With(
     {
     wFilter: Filter(
     'CPAR Tracker',
     IsBlank(Text(txtSearch_Number)) || Text(txtSearch_Number)= 'CPAR Number'
     )
     },
     Search( wFilter, txtSearch_Subject.Text, "Subject")
    )

     

    Note: Search() isn't delegable so you can only search, at most, 2000 records - but the Filter should reduce your records to under that?

  • Sadiejane Profile Picture
    76 on at

     

    Thank you for helping... 
    I get an error on the Search

    Sadiejane_1-1675201653975.png

    'Search' has some invalid arguments, I tried a few things, no quotes, single quotes, to no avail

     

  • EddieE Profile Picture
    4,650 Moderator on at

    @Sadiejane 

    What is the column called that you are trying to search on? I assumed it was called "Subject" given your first code snippet.

  • Sadiejane Profile Picture
    76 on at

    Yes, the column I am trying to search on is subject. That's what is so weird, it works with Startswith, but doesn't appear to work with Search

  • EddieE Profile Picture
    4,650 Moderator on at

    @Sadiejane 

    What data type is Subject? Is it of type Text or something else like a Choice column?

     

    Also, if it is a Text column, check that "Subject" is the actual name of the column. You can do this by clicking on the column in List Settings then checking the last part of the URL. The column name is shown here.

  • Sadiejane Profile Picture
    76 on at

    "Subject" is the actual name-would it work with Startswith if it wasn't? It is a multiline text type. I just don't understand why it works with Startswith but not Search... Thanks for helping me, I really appreciate it. I am so stuck...

     

  • EddieE Profile Picture
    4,650 Moderator on at

    @Sadiejane 

    Can you post your full formula that you are using and also what the error is saying.

  • Sadiejane Profile Picture
    76 on at

    Hi, thanks again for your help

    This is what is working-it works great, no errors. I just need to search the whole "Subject" not just what it starts with and that's why I want to add "Search" not "Startswith"

    **********************************************************************

    Filter(
    'AVK CPAR Tracker',

    IsBlank(Text(txtSearch_Number))||Text(txtSearch_Number)= 'CPAR Number',
    StartsWith( Subject, txtSearch_Subject.Text
    )
    )

    *******************************************************

     

    Here is the one I tried and it has an error message shown below the code

    *********************************************************

    Filter(
    'AVK CPAR Tracker',

    IsBlank(Text(txtSearch_Number))||Text(txtSearch_Number)= 'CPAR Number',
    Search( Subject, txtSearch_Subject.Text)
    )
    )

    *****************************************************

    Sadiejane_0-1675295412005.png

     

     

     

  • EddieE Profile Picture
    4,650 Moderator on at

    @Sadiejane 

    Search() needs a table as it's first argument so you can try this

    Search( 
     Filter(
     'AVK CPAR Tracker',
     IsBlank(Text(txtSearch_Number)) || Text(txtSearch_Number)= 'CPAR Number'
     ),
     txtSearch_Subject.Text, Subject
    )

     

    You also appear to have a delegation warning (blue line underneath the equals) at this part of your formula

    Text(txtSearch_Number) = 'CPAR Number'

     

    Maybe you need to change this to ??

    Value(txtSearch_Number) = 'CPAR Number'

     

  • Sadiejane Profile Picture
    76 on at

    Thank you again for your help.

    I tried your latest solution and get -The 'Search' function has invalid arguments-

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard