top of page
Search

Search, Filter, and Set Default Values for a Combo Box in Power Apps

While building applications for your business, you may come across instances where you must allow users to make multiple selections from provided choices. Looking up employee records or the contact information of reps for specific brands are two such instances.


Fortunately, Power Apps has a way to handle that. A combo box is a control that allows users to search for specific items and select many of those items. Since the search is performed server-side using the SearchField property, it can easily handle large data sources.


Here’s a closer look at how to use a Power Apps combo box to search, filter, and set default values.



Follow along with our YouTube video.


How to Search, Filter, and Set Default Values for a Combo Box in Power Apps

Top on the list of most useful features in Power Apps is the combo box. A combo box looks like a drop-down tool, but its functionality makes it so much more than that. Here’s how to use Power Apps combo box to search, filter, and set default values.


Creating a Combo Box

To create a combo box, select “Insert” then “Controls.” Choose “combo box” from the drop-down.


It will default to the ComboBoxSample, but a Data pane will open to the right. Simply replace the data source in the drop-down given there. (Here’s how to add data sources to Power Apps.)


Next, select the layout. Three choices exist:

  • Single. One field of data is shown in the combo box.

  • Double. Two fields of data are shown (our very first example used this).

  • Person. It’s the double layout with an image.

Finally, select the primary text and the secondary text (for double layouts), as well as the SearchField.


How to Search

SearchField governs in which field the combo box will search when the user types into the box. The default is the primary text, but you can change that.

The easiest way is to simply change the value in SearchField. But if you want to search multiple fields, choose “SearchFields” from the properties drop-down next to the functions. Then, simply include the fields desired.

For example, we changed:


SearchFields = ["Company Name"]


to


SearchFields = ["Company Name", "SalesPerson"]


Our combo box then searched both the company name and the salesperson name when we typed in a value.


How to Filter Data

Filtering is helpful when you’re dealing with a large set of data and you don’t want to overwhelm your users.


In our example, we filtered our data so that combo box showed only the values where SalesPerson = Pamela. Our code on the Items property looked like this:


Filter('[SalesLT].[Customer]', SalesPerson = "adventure-works\pamela0")


How to Set a Default Value

With a combo box, “default” isn’t a useful property. To set the default value, use “DefaultSelectedItems” instead. This causes specified records to display by default. To set DefaultSelectedItems, use the Filter function for the same datasource you used for your Items property.


Other Combo Box Functions

There are a few neat functions with combo box that we covered. These are worth keeping in mind because they will come in handy:

  • SelectMultiple: If you don’t want users to be able to make multiple selections in the combo box, then set SelectMultiple to “false.”

  • SelectedItems: The property to recall the output of a combo box is SelectedItems which returns a table of information from your combo box selection. For example, in this tutorial we populated a drop down using “ComboBox5.SelectedItems.EmailAddress”.

  • Concat: To turn a field in the table output from SelectedItems into a string of text, we used: Concat(ComboBox5.SelectedItems, EmailAddress, ", ")

  • DisplayFields: Change these to alter what data comes back when a user makes a selection.

  • Master Power Apps Combo Box and More with Us

Combo box may look like a drop-down, but it has more functionalities and requires some slightly different functions. We’ve covered how to search, filter, and set values in a Power Apps combo box plus given you a heads up about especially useful functions.

Just remember: combo box likes to pass records.


As long as you nail that, you’ll have no trouble using combo box to pull the data your business needs.



61,433 views0 comments
bottom of page