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 / Search on text and int...
Power Apps
Unanswered

Search on text and int columns using 1 search box (textinput)

(0) ShareShare
ReportReport
Posted on by 107

Hi power app experts,

 

My datasource is sql server, and my table has text and int columns.
Lets look at 2 columns "Name" (text) and "ID" (int).
I have a gallery with these columns and I use a textinput field for searching capabilities.

 

I tried to write a search formula in gallery items as follows:

If( !IsBlank(TextInput),
    Search(datasource, TextInput.Text, "Name", "ID"),
    datasource)

It fails because the search function want to only search on text.
What can I do to combine searching for both datatypes.

Any help, workarounds will be appreciated
Thanks

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,125 Most Valuable Professional on at

    @SearchingYT ,

    Correct - Search() only functions on Text values - you cannot search on a numeric value. You could do this

     

    If(
     !IsBlank(TextInput),
     Search(
     Filter( 
     datasource, 
     ID = Value(TextInput.Text)
     ),
     TextInput.Text, 
     "Name"
     )
    )

     

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • SearchingYT Profile Picture
    107 on at

    @WarrenBelz  Ok. I tried using your for formula but it didnt work. It returns nothing...

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @SearchingYT 

    How about this

    Filter( 
     datasource, 
     TextInput.Text in "Name" || Textinput.Text = ID
     )
     
  • WarrenBelz Profile Picture
    156,125 Most Valuable Professional on at

    @SearchingYT ,

    Just updating what @Drrickryp has suggested

    Filter( 
     datasource, 
     TextInput.Text in "Name" || ID = Value(Textinput.Text)
     )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • SearchingYT Profile Picture
    107 on at

    @Drrickryp and @WarrenBelz I just tried your formula. This gave me funny results:

    - It works on searching ID. But my search should match exact. So, if ID = 123, I have to type "123" to get a match. If I only type "12", I get no match.
    - It works on searching numbers in Name column but not text. So, if Name = "BBC Radio 3 Channel 201" and I type "BBC" or "Radio", this gives me no results. But, If I type "3" or I type "201", then it matches? This is quite strange.

    Any ideas on what is going on here.
    Thanks.

  • WarrenBelz Profile Picture
    156,125 Most Valuable Professional on at

    @SearchingYT ,

    Correct (on the partial match on ID), you simply cannot do it on a number - as you already have an in Filter which is not Delegable, try this (will limit you to 2,000 items in the search). Also Name is not a good title for a field as it is a Reserved Word in Power Apps.

    With(
     {
     wList:
     AddColumns(
     DataSource,
     "txtID",
     Text(ID)
     )
     },
     Filter( 
     wList, 
     TextInput.Text in Name || TextInput.Text in txtID
     )
    ) 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • SearchingYT Profile Picture
    107 on at

    @WarrenBelz Awesome! The searching functionality works! But, I am running into delegation issues, as you mentioned as well. My datasource tabel has more than 5000 records. Could you please tell me how I could solve delegation issue here.

    Yes, my column name is not Name, it was just for example purposes.

  • WarrenBelz Profile Picture
    156,125 Most Valuable Professional on at

    @SearchingYT ,

    Quite simply Search and in are not Delegable.

    I have a blog on Delegation that has some suggestion for large collections , particularly this one, but note if you get much over 10,000 you will have significant performance issues.

    Is your original question now solved?

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • SearchingYT Profile Picture
    107 on at

    @WarrenBelz Thanks a lot!
    Firstly, Search function is delegable on sql datasource.
    When I search on a text column, I do get matches on more than 2000 rows.
    Yes, "in" is not delegable, but I don't need that as Search function on text column works great.

    The issue here is that with your formula I am collecting my datasource in "wlist". At this point I have already missed rows > 2000.

    I like your solution, but I will not be able to use it here, as my client will get incomplete results...

     

  • WarrenBelz Profile Picture
    156,125 Most Valuable Professional on at

    @SearchingYT ,

    I don't know which option you were using, but it does collect all records - wList is a temporary variable, not the collection name.

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard