You are currently viewing PowerApps Filter and Search function examples
Filter and Search

PowerApps Filter and Search function examples

  • Post author:
  • Post category:Power Apps
  • Reading time:11 mins read

In this Post, we will learn how to use PowerApps Filter and Search function to search for the data you need.

PowerApps Filter and Search function

In PowerApps, we can use the Filter and Search function to find a specific part of data that meet your need.

PowerApps Filter Function

Definition

  • The Filter function in Power Apps used to find the records of the table that adhere to a formula.
  • You can use Filter Function to find a set of records that meet the criteria so If the condition you apply is met, so the records will be displayed; otherwise, they are discarded.

Syntax

Filter(Table*, Formula1 [, Formula2, ... ] )

Where,

Filter the name of the function.
Table Table to be searched, This is required
Required formula(s). The formula used to evaluate each record in the table. The function returns all records with the value true. Columns within the table can be referenced. When more than one formula is supplied, the results of all formulas are combined using the And function.

Filter Function Examples

PowerApps filter gallery by text input

In this example we will filter a gallery that contain data from a SharePoint list, and we will use text input to filter the gallery

PowerApps Filter and Search function
This is the SharePoint list
PowerApps Filter
Power Apps Filter

Example 1:

In this example we will filter the Gallery using the Course Name that is the Title field in the SharePoint List.

We will use this formula in the items property of the gallery.

Filter(Courses,StartsWith(Title,SearchText.Text))

Where,

Filter the name of the function.
Courses Table to be searched, “the SharePoint Search”
Required formula(s). StartsWith(Title,SearchText.Text) that will search the title that start with the text in the search textbox.

powerapps filter gallery
PowerApps Filter and StartsWith function

Example 2:

In this example we will apply multiple criteria, we will filter the Gallery using the Course Name and the Course ID.

You can use logics to compline multiple searches.

Filter(Courses,StartsWith(Title,SearchText.Text)|| StartsWith('Course ID',SearchText.Text))
powerapps filter gallery by text input
PowerApps filter gallery by text input

Example 3:

In this example, we will use the in function with the filter function, to filter the data with a text in any part of the column data.

Filter(Courses,SearchText.Text in Title)

This will search for a string in any place in the Title column of the SharePoint list.

f5 | Power Platform Geeks
power apps filter gallery using in function

Also you can Filter using a specific condition, for example if we add a course rate column that called CourseRate and we want to get all of the courses that have CourseRate>60 for example. Then the formula will be as shown bellow.

Filter( Courses, CourseRate > 60 )

So this how PowerApps filter a gallery. You can use PowerApps Filter Function to find a set of records that meet the criteria you define.

Power Apps Search Function

Beside using the Filter function you can use the Search function in PowerApps to find the records of the table that match your string.

Definition

  • The Search function searches a table for records with a string ,The string can appear anywhere in the column.
  • Searching is case-insensitive, and unlike Filter, the Search function matches with a single string rather than a formula.

Syntax

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

Where,

Search – the Name of the function
Table is the table for searching. And it is required.
SearchString The search string. All records are returned if the parameter is blank or an empty string. and it is Required in the formula.
Column(s) – Required. The names of the columns within Table to be searched. Text must be present in the searchable columns. Column names must be strings enclosed in double quotes. However, the column names must be static and cannot be calculated using a formula. If SearchString is found as a partial match within the data of any of these columns, the full record is returned.

PowerApps Search gallery

Now we will learn how to use the Search function with the gallery control.

Example 1:

In this example we will search for a string in the title column with partial match within the data of this column.

Search(Courses,SearchText.Text,"Title")
powerapps search gallery
powerapps search gallery
f6 | Power Platform Geeks
powerapps search gallery

Example 2:

In this example we will search for a string in the title and the Course id columns with partial match within the data of any of these columns.

Search(Courses,SearchText.Text,"CourseID","Title")
f8 | Power Platform Geeks
f9 | Power Platform Geeks
Conclusion

In this Power Apps post we know the following :

  • What is the power Apps Filter function?
  • What is the power Apps Filter function?
  • How to to use filter and search function with SharePoint List?
  • How to use the search and filter functions with multiple conditions?
See Also
Join us
Need Help
  • Have a related question? Please ask it at deBUG.to Community.

Heba Kamal

Microsoft MVP, MCT, Technical Speaker, Blogger, and Microsoft 365 and Power Platform Consultant.