One of the most common scenarios is to be able to perform a Search on the Dataverse table like Accounts, Contacts etc. across multiple columns. Just like you would do on a Quick Search in a Dynamics 365 CE (CRM).
Let’s see how we can replicate this using Search() function in Canvas Power App to implement Search across multiple columns in a Canvas Power App.
Gallery and Search Control
As a typical setup, I’ll implement a Gallery control to populate all Accounts and have the Search Text Input control for the user to enter the search term. Let’s see how we can set this up quickly –
- I’ve added a Gallery control that will populate the Accounts from the Dynamics 365 (Dataverse) instance and I’ve added a Search which is a Text Input which user can use to enter the Search term.
- Here are the fields which are selected to be displayed on the Gallery. Account Name will be shown larger in bold and below is the City to give it a subtitled look.
- Once this is set, we’ll look for Items of the Gallery and proceed to modify it. You’ll see the Default Items populated already based on how you populated the Gallery when you connected to your Dataverse.
Let’s modify this.
- Now, we’ll clear the Items formula bar and then write the below Search() function –
Search – Denoted by Blue arrow, Search() function is used in Canvas Apps to Search from a Data Source but first selecting thee data source in the first parameter, then the Search Term and finally listing all thee columns of the data source separated by commas. Here’s thee official documentation of the Search functionality as provided in Microsoft – Docs https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup?WT.mc_id=DX-MVP-5003911
Accounts – Denoted by Green Arrow, Accounts if the Data Source i.e. thee Dataverse environment which is fetching theee Accounts table and populating the Gallery.
SearchInput.Text – Denoted by Orange arrow, SearchInput.Text is the text which users will enter to Search from the Dataverse i.e. from Accounts table in order to show up.
Fields – Denoted by Red Underline, the fields can be listed from the Data Source and the Search will be carried out amongst those columns.
Now, let’s see how this will work –
- By default, if the Search Box is blank, all the records will be shown.
- Once, users start to enter text into the same, the Items of the Gallery will start populating based on the Search.
I’ve also implemented this using the Filter function as well – Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
Hope this was useful!
Here are some more Canvas Power App posts you might want to check out –
- Call a Flow from Canvas Power App and get back response | Power Platform
- Enable Custom Code Components (PCF Controls) to be imported in a Canvas Power App | Quick Tip
- Retrieve Hashtags from Text in a Canvas Power App | Power Platform
- Rich Text Control for Canvas and Model-Driven App | Quick Tip
- Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]
- Rating Control to represent data from Dataverse in a Canvas Power App | Power Platform
- Clear a field value & Reset Form in a Canvas Power App [Quick Tip]
- Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
- Debug Published Canvas Power App with other users using Monitor | Power Platform
- Download a File from a Canvas Power App using a button | Power Platform
- Dependent OptionSets in a Canvas Power App for 1:N related CDS entities | Power Platform