PowerApps Search Function + How to use with example

In this Power Apps Tutorial, We will discuss what is the PowerApps Search function, it’s syntax, how to use the Power Apps search function in a canvas app. We will see how to apply a search box in PowerApps.

We will also see how to search for items from the SharePoint list using the PowerApps search function.

Also, We will see how to use the Search function in a Vertical Gallery Control and how can you do multiple searches.

Also, We will discuss what is the PowerApps Search Delegation and how to use the Search function in a Drop-down control in Power Apps.

Power Apps Search Function

We can use the PowerApps search function to find records from a table that contains a string value in any of the columns. The search string can be presented anywhere in the columns.

PowerApps search function returns the same columns which are presented in the table from where you searching.

The table should contain columns which are having a Text or String value. Apart from a Text value, it will not take any other column value like Number, Choice, Picture, Hyperlink, etc.

Also, a Lookup column does not work with the Power Apps Search function at all.

The Search function uses a single string to match instead of a formula. That’s why this Powerapps Search function is case-insensitive in nature.

PowerApps search function syntax

Below represents the Power Apps Search Function Syntax:

Search( Table, SearchString, Column1 [, Column2, ... ] )

Where,

  • Search = It is the Power Apps function which helps to search.
  • Table = Specify the Table name that is used to search.
  • SearchString = Specify the string to search for. It will be returned to all the records if there will be a blank or an empty string.
  • Column(s) = Specify the column names those you want to search from the table. Whatever you are passing the columns, it should be a Text column and the column names should be strings which is in double-quotes. The specified column name should be static and cannot be calculated with a formula.

Use PowerApps Search Function in a Vertical Gallery Control

We can use the Search function in a Vertical Gallery control, follow the below steps:

If you are new to PowerApps, then check out few article on Create a canvas app from Excel in Power Apps (Step by Step tutorial) and also you can check How to Create a Canvas app from SharePoint List in Power Apps.

Step-1:

First of all, On your PowerApps Screen, Add a Blank Vertical Gallery Control (Insert -> Gallery -> Vertical). Then connect a Data Source as SharePoint (As my records are present in a SharePoint List) as shown below.

powerapps search function sharepoint list
Power Apps SharePoint data source

Step-2:

Select or Enter your SharePoint site or URL and Connect it. Then choose your SharePoint List (Event Registration Details) and hit on the Connect button.

NOTE:

Not only you can use the Data source like SharePoint, But also, you can use the Data source as Excel (Import from Excel).
PowerApps Search Function
SharePoint data source in PowerApps

Step-3:

In the below screenshot, you can see all the records are retrieved from the SharePoint List. Here, your Item property should be your SharePoint List name (‘Event Registration Details‘).

Select the Gallery and go to the Properties pane. Select the Layout as “Title, subtitle, and body“. Edit the fields and add the columns as per your choice.

powerapps search function gallery
PowerApps Gallery Control

Step-4:

Now to search the fields from the PowerApps vertical gallery, we need to add a search bar on the top of the Gallery. For that, Go to Insert -> Text -> Add Text Input as shown below.

The Text input control will insert and it will show the default value as Text. Just remove the Default value.

Search Function in PowerApps
PowerApps Text input control

Instead of the Default value, We will add a HintText value as “Search on Name”. instead of Name, you can provide anything like “Search on Profile”, “Search on Department”, “Search on Organization” etc.

The benefit of adding the HintText in the text control is, it will look like a Search box and more attractive.

powerapps search function multiple conditions
PowerApps search function hinttext

Step-5:

Add a Search icon (Insert -> Icons ->Search) near to the Search box. So that it will look like a perfect Search box to find out any fields like the below screenshot.

The OnSelect Property of the Search icon should be false.

powerapps search function syntax
PowerApps search icon

Step-6:

Select the Vertical Gallery control and apply the below Search function formula on its Items property as:

Items = Search('Event Registration Details', SearchBox.Text, "Title")

Where,

  • Search = This is the function used to find out the record from a table.
  • Event Registration Details‘ = This is the SharePoint List name.
  • SearchBox.Text = This is the Text input control name that I have added for searching.
  • Title” = It is the SharePoint List column name which is used to search in the search box.
powerapps search function example
PowerApps search function example

Step-7:

Just Preview (F5) or run the app. Search by Title or Name in the Search bar, then you can see it will search by the particular name and give you the appropriate result as shown below.

power apps search function sharepoint list
Search in PowerApps

PowerApps search function multiple conditions

Suppose, you want to do multiple conditions searches using the Search function in PowerApps. That means, if you want to search by Name, also you want to search by Organization or by Email Address, then you can do it.

But, all the fields should contain only the String or Text value otherwise it will not allow us to search and an error will appear on the screen.

In this case, you can apply the below formula on the Gallery Items property as:

Items = Search('Event Registration Details', SearchBox.Text, "Title", "Organization", "EmailAddress")

Where,

“Title”, “Organization”, “EmailAddress” = These are the SharePoint list fields that contains only the Text value.

powerapps search function sharepoint list
PowerApps search function multiple conditions

Once you will preview and search by name, by Organization or by Email Address, then it will give you the perfect result as like the below screenshot.

powerapps search function using sharepoint list

NOTE:

Some times, you may get the Search function invalid argument error while using the Search function with multiple conditions in Power Apps. You can overcome this type of issue by using the below Power Apps article:
The function Search has some invalid arguments in PowerApps

Search Delegations in PowerApps

You can see, there will be a warning suggestion is visible on the top of the gallery. This is known as the Delegation suggestion.

You will get this Search Delegation suggestion when your data in the data source exceeds 500 records and a function can’t be delegated. In this case, the Power Apps may not able to get your data and may give the wrong results.

You can use any Data source and formula if you are working with the small data sets which are fewer than 500 data or records.

Solution:

To get over from this Delegation problem, We need to change the Value from the Power Apps Advanced settings.

This can be easily changed by using the File tab -> Settings -> Advanced settings -> Value -> make the Value as 500 to 2000 as shown in the below screenshot.

Search function Power apps
Search Delegations in Power Apps

The value will take in between 1 to 2000 only. Once it exceeds 2000, then it won’t take.

Also, you can do another thing. If your data in the Data set is having more than 500 value, then you need to break the data from data sets in an equal manner. After that, make individual data set and each data set value should be 500.

PowerApps Search using a Drop-Down Input Control

You can use the PowerApps Search function using a Drop-down control. On your Power Apps screen, Add a Dropdown control (Insert -> Input -> Dropdown) as shown below.

powerapps searchable dropdown
PowerApps drop down control

Select the Drop-down input control and apply the below formula on it’s Items property as:

Items = Search('Event Registration Details', SearchBox.Text, "Title", "Organization", "EmailAddress")
power apps searchable dropdown
powerapps search dropdown

When you will preview the app, then you cannot able to see anything in the drop-down control as shown below.

The reason behind this thing because the above Search formula is returning all the columns from the SharePoint List (Event Registration Details).

To show a particular column value, We need to use the ShowColumn function.

power apps searchable drop down
powerapps search dropdown list

Apply the below formula on the Drop-down Items Property as:

Items = ShowColumns(Search('Event Registration Details', SearchBox.Text, "Title", "Organization", "EmailAddress"),"Title")

Not only you can use the Show Column value as “Title”, But also, you can use any other Text or String column like “Organization”, “EmailAddress”, etc.

powerapps searchable drop down
powerapps dropdown search field

Now preview or run the app and click on the drop-down. You can see all the Titles or Names as below screenshot.

searchable dropdown powerapps
powerapps search dropdown list

Similarly, When you will search the name on the Search box, it will reflect in the Dropdown bar. Suppose, you are searching a name by “Sania”, then the name “Sania” is reflecting in the Dropdown bar as shown below.

searchable dropdown power apps
powerapps search dropdown list

Also, you may like below Power Apps tutorials:

In this Power Apps Tutorial, we discussed what is the PowerApps Search function and how to use the PowerApps search function to search items from a SharePoint List. and also PowerApps Search function syntax.

Also, We saw how to use the Search function in a Vertical Gallery Control and how can you do multiple searches.

Also, We discussed what is the Power Apps Search Delegation and how to use the Search function in a Drop-down control in PowerApps.

I hope you learn about PowerApps search function and how to add search box for list screen in PowerApps.

>