In this Power Apps Tutorial, we will discuss, how to use Power Apps search() function in SharePoint list.
We were recently asked to use the Power Apps Search function() while working with the Power Apps canvas app.
This tutorial will also show you how to work with the Power Apps Search() within a SharePoint list based on various columns. Such as:
- Power Apps search text column
- Power Apps search lookup column
- Power Apps search choice column
What is the Power Apps Search() function?
PowerApps search() function is used to locate records in a table that have a string value in any of the columns.
The PowerApps search function returns the same columns that are shown in the table from which you searched. The search string can appear in any of the columns. Searching is not case-sensitive. For e.g., searching for “ame” or “Rica” would return a result in a column containing “America.”
If there is no record found, then the Power Apps Search() will return an empty table instead of a blank one.
To use this function, the syntax is:
Search(Source, text, column,...)
Where,
- Source indicates the table to search items.
- text indicates the text to search for.
- column(s) is the names of the columns to search within the Table. The text must be present in the columns to be searched. Column names must be strings surrounded by double quotes.
What is Power Apps search in the SharePoint list?
As the name suggests Power Apps search() SharePoint list, is used when a user wants to find and display any records from a SharePoint list data source.
While working with the Search function within the SharePoint list, make sure to connect the SharePoint List data source connector to the app.
Follow the below examples to see how to work with the Power Apps Serch function in the different types of SharePoint list columns.
Example-1: Power Apps Search SharePoint text column
In this example, we will see how to use the Power Apps Search() function within the SharePoint list text columns. That is, when the user enters any text into the text input control, the data will be displayed in accordance with the searched text based on the product’s title.
There is a SharePoint list named Products having various types of columns such as Title (Single line of text), Price (Currency), Delivery Date and Order Date (Date and time), Image (Thumbnail), and Manufacturer (Choice column).
- Prepare a blank canvas app and connect the above SharePoint list to the Power Apps. (Navigate Add Data > SharePoint > Connector > Select list > Connect)
- Add a blank vertical gallery to the Power Apps screen and connect that gallery with the SharePoint list (i.e., Products). As a result, it will retrieve all the columns with data from the SharePoint list to the Power Apps gallery as shown below:
- Add a text input control to the Power Apps screen and give a hint text to the control.
HintText = "Insert text to search"
- Add a Search icon to the app and place it inside the text input as below:
- Next, insert the below expression on the gallery’s Items property to display the items as per the searched text.
Items = Search(Products, SearchBox_textInput.Text, "Title")
Where Products is the name of the SharePoint data source, SearchBox_textInput is the name of the text input control, and “Title” is the name of the SharePoint list text column.
That’s it! Let’s run the app and enter any text into the text input to search for items (Ex: top). As shown below, the items whose titles contain the searched text will be displayed:
This is an example of how the Power Apps search function works on the SharePoint list text column.
Example-2: Power Apps search choice column
In this example, we will see how to use the Power Apps Search function with the SharePoint choice column. When a user enters text into the search bar, it will only display data whose choice field matches the searched text.
Requirement:
To work with this, we are going to use the above SharePoint list of Products having a choice column named Manufacturer. When the user inserts the value in the search bar (Ex: Apple), as per the searched text the items will display in the table or gallery.
As the Power Apps Search function only allows the Text or string type field, we can’t use the number, date, lookup field, choice field, or image field within the Power Apps search(). But, instead of the Search() function, there is another function named Power Apps filter() that will return filtered data as per the inserted text.
The meet the requirement, the following steps are:
- Insert the below expression on the gallery’s Items property to display the filtered data as per the inserted text.
Items = Filter(Products, Manufacturer.Value = SearchBox_textInput.Text)
Where Manufacturer is the choice column of the Products SharePoint list. So it is noted as Manufacturer.Value
That’s all! Let’s preview the app and insert a choice value within the search bar (Ex: Apple). It will filter all the SharePoint data and display only filtered data based on the inserted value.
This is how to search for items using the SharePoint choice column within the Power Apps.
Example-3: Power Apps Search lookup column
Similarly, in this example, we will see how to use the Power Apps search function within the SharePoint lookup column.
That is when the user inserts any text to search the items, the table’s items will be visible based on the searched text. As the Power Apps Search function does not support the lookup field, so we are going to use another method to meet the requirement.
Here, we have a SharePoint list named Workers having a lookup column Department as shown below:
- On the Power Apps screen, add a Power Apps Data table and connect the above SharePoint list to retrieve all the columns along with the data.
- Add a text input to the screen and a Search icon into the text input control.
- Insert the below expression on the data table’s Items property.
Items = Filter(Workers, Searchbar_TextInput.Text in Department.Value)
Where Workers is the name of the SharePoint list, Searchbar_TextInput is the name of the Power Apps text input, and Department is the name of the SharePoint lookup column.
Let’s preview the app and insert a text inside the text input (Ex: i). We can see the data will come like below:
This is how to search SharePoint lookup column items within the Power Apps.
Conclusion
From this Power Apps Tutorial, we learned how to use the Power Apps search function within the SharePoint list columns. Such as:
- Power Apps Search function
- Power Apps search in Sharepoint list
- Power Apps search in the Sharepoint text column
- Power Apps search in the SharePoint choice column
- Power Apps search lookup column
You may also like the following Power Apps tutorials:
- Create a Power Apps dialog box or Popup message box
- How to do group by and calculate sum in Power Apps?
- How to get current date in Power Apps?
- How to calculate sum of gallery items in Power Apps?
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.