Power Apps  

Implementing Search Functionality in Power Apps Using the Search() Function

Introduction

In Power Apps, users often need to quickly find specific records from large datasets. To support this, Power Apps provides the Search() function, which allows filtering records based on a text input across one or more columns. This article explains how to implement a dynamic search feature using a collection as a data source and a gallery to display filtered results.

What Is the Search() Function in Power Apps?

The Search() function filters a table and returns records that contain the search text in specified columns.

Syntax

Search(DataSource, SearchText, Column1, Column2, ...)

Parameters

  • DataSource – Table or collection to search from

  • SearchText – Text entered by the user (usually from a Text Input control)

  • Column1, Column2, … – Columns where Power Apps will search the text

The function performs a case-insensitive partial match, making it ideal for user-friendly search experiences.

Step 1: Creating Sample Data Using a Collection (OnStart)

Instead of connecting to SharePoint or Dataverse, we can use a local collection for learning and testing.

In App → OnStart, use:

image (2)
ClearCollect(
    colEmployees,
    { ID: 1, Name: "John Smith", Department: "HR", Email: "[email protected]", Location: "New York" },
    { ID: 2, Name: "Sara Johnson", Department: "IT", Email: "[email protected]", Location: "London" },
    { ID: 3, Name: "Michael Brown", Department: "Finance", Email: "[email protected]", Location: "Toronto" },
    { ID: 4, Name: "David Wilson", Department: "IT", Email: "[email protected]", Location: "Sydney" },
    { ID: 5, Name: "Emily Davis", Department: "HR", Email: "[email protected]", Location: "Chicago" },
    { ID: 6, Name: "Robert Miller", Department: "Sales", Email: "[email protected]", Location: "San Francisco" },
    { ID: 7, Name: "Sophia Taylor", Department: "Marketing", Email: "[email protected]", Location: "Berlin" },
    { ID: 8, Name: "Daniel Anderson", Department: "Support", Email: "[email protected]", Location: "Dublin" },
    { ID: 9, Name: "Olivia Thomas", Department: "Admin", Email: "[email protected]", Location: "Singapore" },
    { ID: 10, Name: "James Martin", Department: "Operations", Email: "[email protected]", Location: "Dubai" }
)

After adding this, run the app once so the collection gets created.

Step 2: Add Search Text Input Control

Insert a Text Input control and name it:

txtSearch_1

This control will capture what the user types to search for employees.

Step 3: Display Data Using a Gallery

Insert a Vertical Gallery and set its layout to:

image (3)

Bind fields like:

  • Title → Name

  • Subtitle → Department

  • Add labels for Email and Location if needed

Step 4: Apply Search Formula to Gallery Items

Set the Items property of the gallery:

Search(
    colEmployees,
    txtSearch_1.Text,
    Name,
    Department,
    Email,
    Location
)

What This Does

  • Searches in 4 columns: Name, Department, Email, Location

  • Updates results in real time as the user types

  • Supports partial matches (e.g., typing “IT” shows all IT employees)

Example Search Scenarios

User InputMatching Records
johnJohn Smith
ITSara Johnson, David Wilson
TorontoMichael Brown
@company.comAll employees

This makes the search highly flexible and user-friendly.

Important Notes About Search()

Works Best With:

  • Text columns

  • Small to medium datasets

  • Collections and non-delegable sources

⚠ Delegation Limitation

If you use SharePoint or Dataverse with large data, Search() may not be delegable.
In such cases, use combinations of:

  • Filter()

  • StartsWith()

for better performance.

When to Use Search() vs Filter()

ScenarioRecommended Function
Free text search across many columnsSearch()
Exact match or logical conditionsFilter()
Large SharePoint listsFilter + StartsWith

Use Cases in Real Projects

This pattern is very useful in apps like:

  • Employee Directory

  • Asset Tracking App (search by serial, owner, location)

  • Timesheet Management (search by employee or project)

  • Helpdesk Ticket System

Shubham, this is very similar to what you build in Timesheet and Asset Tracking apps, so the same logic can be reused there with SharePoint or Dataverse data sources.

Conclusion

image (4)

The Search() function in Power Apps provides a quick and efficient way to filter records using free-text input across multiple columns. By combining:

  • Collections (for local data)

  • Text Input control

  • Gallery with Search()

you can build responsive and user-friendly search experiences with minimal formulas. This approach is perfect for learning, prototyping, and small production apps.