Latest Posts

PowerApps Search for records in a table


The Search function in PowerApps is used to search for records in a table that contain a specified text string. It allows you to filter a table based on a text input, making it easier to find relevant data.

PowerApps – Search() function Syntax

 

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

  • Table: The table in which you want to search.
  • SearchString: The text string you are searching for.
  • Column1, Column2, ...: The columns in which you want to search for the text string.

Notes:

  • Large Datasets: For large datasets, consider delegable functions to improve performance. The Search function is not delegable for all data sources, so it may not work efficiently with large datasets.
  • Delegation Warning: Be aware of delegation warnings in PowerApps, which indicate that the entire dataset may not be searched, potentially leading to incomplete results.

PowerApps – Search for record in a table – multiple columns

Suppose you have a table called Employees with columns Name, Department, and Title. You want to search for employees whose name or department contains the text "manager":

 

Search(Employees, "manager", "Name", "Department")

  1. Using with a Text Input

If you have a text input control named TextInput1 and you want to search a table called Products in the ProductName and Category columns:

 

Search(Products, TextInput1.Text, "ProductName", "Category")

  1. Combining with Other Functions

You can combine Search with other functions like Sort to sort the search results. For example, to search and sort products by price:

 

Sort(

    Search(Products, TextInput1.Text, "ProductName", "Category"),

    Price,

    Ascending

)

PowerApps – Handle No Results with search function

You can handle scenarios where no results are found by displaying a message or handling the empty state of the gallery:

 

If(

    IsEmpty(

        Search(Inventory, SearchInput.Text, "ItemName", "Description")

    ),

    "No items found",

    Search(Inventory, SearchInput.Text, "ItemName", "Description")

)

This will display "No items found" if the search returns no results.


We value your Feedback:

Page URL:

Name:

 

Email:

 
 

Suggestion:

 

© 2024 Code SharePoint