
In this video, Matthew Peterson provides a solution for fixing issues with the search function in Canvas Power Apps. Recently, some users have experienced problems where the search feature that previously worked fine suddenly fails to return results, especially with certain data sources. Matthew walks through a practical workaround to resolve this issue by using a global variable and a simple trick to simulate user interaction with the search field.
Understanding the Search Bug
Search functionality in Power Apps typically works by allowing users to type text into an input field, which filters data in a gallery based on the entered text. However, there have been recent reports where the search function appears to be "stuck," and no results are returned, even when the input field is used correctly. This issue is primarily seen with delegable data sources like SQL, where Power Apps relies on the data source to handle the search operation.
Step-by-Step Workaround
To work around this bug, Matthew introduces a simple solution using a global variable. The idea is to "trick" the input control into behaving as if a user had typed something and then erased it, causing the gallery to reload correctly. Here's how it works:
- Create a text input field for the user to type their search query and remove any default text from the inputβs
Default
property. - Set up a global variable in the appβs
OnStart
property to automatically simulate the input of a character followed by its removal. - In the
OnStart
property, useSet(VAR_Search, " ")
followed bySet(VAR_Search, "")
to set the search input to a space and then clear it. - Assign the variable to the
Default
property of the search input control. - Run the
OnStart
function to trigger the simulated input and force the search results to display properly.
Addressing the Bug in Delegable Data Sources
Matthew explains that this issue mainly affects data sources where search is delegable, such as SQL Server, meaning the data source itself performs the search. In non-delegable data sources, like SharePoint, Power Apps handles the search, and the issue may not appear. The workaround ensures that search functionality is restored, regardless of the data source.
Conclusion
If you've encountered problems with search in your Canvas apps, this video provides a quick and effective workaround to ensure your galleries display search results correctly. By using a global variable and simulating input, users can bypass the issue until a permanent fix is available.
Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Power Apps and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up to date on the latest tips and tricks.
Sign-up now and get instant access
ABOUT THE AUTHOR
Matt Peterson is a Trainer for Pragmatic Works specializing in the Power Platform. He graduated from the University of North Florida in 2006 and comes with 15 years of teaching experience in high school algebra. Matt earned the accomplishment in 2013 of being named the Florida Gifted Teacher of The Year. His primary focus is helping our customers learn the ins and outs of Power Apps and Power BI.
Free Trial
On-demand learning
Most Recent
private training
Leave a comment