Power Apps combo box default value

Would you like to set a default value when using a combo box control in Power Apps? If so, this Power Apps tutorial will show you how to set a default value within a Power Apps combo box control based on various scenarios, such as:

  • Power Apps combo box default value
  • Power Apps combo box default multiple values
  • Power Apps combo box default value text
  • Power Apps combo box default value from SharePoint list
  • Power Apps combo box default value empty
  • Power Apps combo box default value variable
  • Power Apps combo box default value from gallery
  • Power Apps combo box default value lookup
  • Power Apps combo box default value based on another combo box

Power Apps combo box default value

A combo box control in Power Apps typically holds the options and the items for the user to select. It can be strange to scroll through a list of combo box items to find a specific item. In this case, we must specify a default value in the Power Apps combo box control.

The properties DefaultSelectedItems and Default in the Power Apps combo box control allow the user to select the initial item(s) before interacting with the control. However, because the Default property is deactivated, use the DefaultSelectedItems property instead.

To find this property, we are going to add a combo box control to the Power Apps screen. Then select the control and go to the Advance Property or the top properties panel > DefaultSelectedItems.

Power Apps combo box default value
Power Apps combo box default value

Now we will add a default value to the combo box control. As a result, when the user launches the app, it will display the previously selected item by default. For this, the following steps are:

  • Let’s add some custom values on the Items property of the Power Apps combo box control.
Items = ["USA","UK","Canada","India","Russia","Brazil"]
Power Apps combo box set default value
Power Apps combo box set the default value

To set a default selected value, on the DefaultSelectedItems property insert a default value from the above choices like below:

DefaultSelectedItems = ["Canada"]
Power Apps set a combo box default value
Power Apps set a combo box default value

Every time it will display “Canada” as the default selected value while opening the Power Apps. This is how to set a default value within the Power Apps combo box control.

Read How to Reset Power Apps Combo Box

Power Apps combo box default multiple values

Because the Power Apps combo box control accepts multiple-selected values, we can also set multiple values as the combo box control’s default selected items. In this section, we’ll look at how to set multiple default values within the Power Apps combo box control.

We are going to use the above example of the custom combo box control where we will set multiple items as the default selected items. Suppose, we want to set both ‘Canada and USA‘ as the default items. For this, we will set the DefaultSelectedItems property as below:

DefaultSelectedItems = ["Canada", "USA"]

Note: The text value is enclosed with the pair of square braces and denoted within the ” “. Similarly, multiple text values are separated within the square braces by commas (‘,’) and ” “.

Power Apps combo box set default multiple values
Power Apps combo box set default multiple values

Whenever we will open the specific app, we can see these items as the default selected items. This is how to set default multiple values within the Power Apps combo box control.

Read Power Apps combo box with Office 365 users

See also  How to Change Trigger in Power Automate [3 Different ways]

Power Apps combo box default value text

There are different ways to set the text value as the default value within the Power Apps combo box control.

Case-1: Set default value manually

In the preceding example, we set the text value for the combo box’s default selected item as an array. For example:

DefaultSelectedItems = ["<Text Value from the combo box choices>"]

Follow the above example to set the text value as the Power Apps combo box default value.

Case-2: Set default value using table()

There is another way to set the text value as the default selected item within the Power Apps combo box control. Here, we will use a Table() to store the default value and use it in the control.

To implement this, we are going to use the above example of the Power Apps combo box control. Insert the below expression into the DefaultSelectedItems property of the combo box control.

DefaultSelectedItems = Table({Value: "Canada"},{Value:"Russia"})
Power Apps combo box default value text
Power Apps combo box default value text

Whenever the user opens the app, the above default selected items will be displayed within the Power Apps combo box control. This is how to set the Power Apps combo box default text value.

Read How to Sort Combo Box Items in Power Apps

Power Apps combo box default value from SharePoint list

Here, we will see how to set a default value within the Power Apps combo box control using the SharePoint list. That means we will build a Power Apps combo box control using a choice column from a specific SharePoint list.

Suppose, we have a SharePoint list named BikeSales having a Title (Default) and Payment Mode (Choice column).

Power Apps combo box default value from SharePoint list
Power Apps combo box default value from SharePoint list

Connect the above SharePoint list to the app to work with in Power Apps. Then, on the Power Apps screen, we’ll add a combo box control based on the SharePoint list choice column mentioned above. For this, insert the below expression in the Items property of the combo box control.

Items = Choices(BikeSales.'Payment Mode')
Power Apps combo box default value from SharePoint choice column
Power Apps combo box default value from SharePoint choice column

From the above combo box control, let’s set the Advance Payment as the default selected item. For this, insert the specific item within the DefaultSelectedItems property like the below:

DefaultSelectedItems = ["Advance Payment"]
Power Apps combo box default value from SharePoint
Power Apps combo box default value from SharePoint

Each time when we open the app, it will display the ‘Advance Payment’ as the default selected item.

This is how to set the Power Apps combo box default value using the SharePoint list column.

Read How to Patch Power Apps Combo Box

Power Apps combo box default value empty

While working with the Power Apps combo box control, it will appear blank and let the user select their desired items from the combo box control. However, we can set an empty value in the Power Apps combo box control’s DefaultSelectedItems property programmatically or with a Blank().

DefaultSelectedItems = Blank()
Power Apps combo box default value empty
Power Apps combo box default value empty

This is how to set the Power Apps combo box default value to empty.

Power Apps combo box default value variable

Here we will see how to set a default value using a variable within the Power Apps combo box control.

That means we will create a variable within the Power Apps and using that variable we will set a default value in the Power Apps combo box control. To work with this scenario, the following steps are:

  • On the Power Apps screen, we will add Button control and insert the below expression on the OnSelect property. So that when the user clicks on the button, it will create a variable and values.
OnSelect = Set(VarApp, ClearCollect(ColApp,{AppName:"Power Apps"},{AppName:"Power BI"},{AppName:"Power Automate"}))

In the above expression, we have created a global variable named VarApp and inside the global variable, we have created a collection named ColApp to hold the multiple values. Where AppName is the name of the collection header.

Power Apps combo box default value variable
Power Apps combo box default value variable
  • Let’s click on the button in the app’s preview mode. We can find all the collection’s values under the global variable below:
Power Apps combo box default value using variable
Power Apps combo box default value using variable
  • Now, add a combo box control to the screen. Set the collection name i.e., ColApp in the Items property.
Items = ColApp
Power Apps combo box default value based on variable
Power Apps combo box default value based on variable
  • To set the default value, insert the below expression on the Combo box’s DefaultSelectedItems property.
DefaultSelectedItems = Filter(VarApp,AppName = "Power Apps")

Where,

  • VarApp: The name of the global variable that we have created
  • AppName: The name of the collection header name that has been created under the global variable
  • “Power Apps”: Specify the default text value from the variable
See also  How to Filter a Power Apps Gallery With Multiple Dropdowns

Once the formula is applied, we can see the combo box will display the default value as Power Apps from the variable itself like below:

PowerApps combo box default value variable
PowerApps combo box default value variable

This is how to set the Power Apps combo box default value from the variable.

Read Power Apps combo box filter

Power Apps combo box default value from gallery

In this section, we’ll look at how to set a default value in the combo box control from the gallery. That is, we will create a gallery and then add a combo box control outside of it.

When a user selects an item from the gallery, the combo box control displays the default choice value. In addition, the user can select any alternate item from the control and modify it into the appropriate gallery item.

To implement these scenarios, we are going to use the above SharePoint list (i.e., BikeSales), and the following steps are:

  • In the Power Apps screen, build a vertical gallery using the above SharePoint list as a data source that is shown below:
Power Apps combo box default value from gallery
Power Apps combo box default value from gallery
  • Add a combo box control to the screen and place it beside the above Power Apps gallery. Insert the below expression on the ‘Items’ property to display the ‘payment mode’ options on the Power Apps combo box control.
Items = Choices(BikeSales.'Payment Mode')
Set default value on Power Apps Combo Box from gallery Selected
Set default value on Power Apps Combo Box from the gallery Selected
  • Now we will insert the below expression on the gallery’s TemplateFill property to get the item that is selected.
TemplateFill = If(ThisItem.IsSelected, LightGoldenRodYellow, White)
  • Also, to display the default choice from the gallery’s selected item on the combo box control insert the below expression on the combo box’s DefaultSelectedItems property.
DefaultSelectedItems = {Value: Gal_BikeSales.Selected.'Payment Mode'}

Where Gal_BikeSales is the name of the Power Apps gallery control name.

Let’s run the app. We can see while selecting any item from the Power Apps gallery, the respective choice value of the Payment mode will display on the combo box control like below.

Power Apps combo box default value from Power Apps gallery
Power Apps combo box default value from Power Apps gallery

If you want to modify the default selected item from the combo box control, insert the below expression on the combo box’s OnChange property.

OnChange = Patch(BikeSales, LookUp(BikeSales, ID = Gal_BikeSales.Selected.ID),{'Payment Mode':Cmb_PaymentMode.Selected})

where Cmb_PaymentMode is the name of the combo box control.

Power Apps combo box show default value from gallery
Power Apps combo box show the default value from the gallery

Let’s select another choice (ex: Advance Payment) from the combo box control to modify the selected gallery item. We can see it will display the modification on the gallery as well as the SharePoint list too.

PowerApps combo box default value from gallery
PowerApps combo box default value from gallery

This is how to set the default value within the PowerApps combo box control from the gallery.

Read Power Apps Combo box with SharePoint list

Power Apps combo box default value lookup

We’ll look at how to use the lookup field to set a default value within the Power Apps combo box control. That is, we will use a combo box control to display the default value from the SharePoint lookup field.

Suppose, we have prepared a SharePoint list named Departments having some departments in the Title column like below:

Power Apps combo box set default value lookup
Power Apps combo box set default value lookup

Next, we have prepared another SharePoint list named Workers, including a lookup column named Department, that looks up the data from the above Departments’ Title column like below:

Power Apps combo box default value lookup
Power Apps combo box default value lookup

Now, move to the Power Apps environment and add an edit form in the Power Apps screen using the above Workers’ SharePoint list.

Power Apps combo box default value lookup field
Power Apps combo box default value lookup field
  • To set a default value from the lookup field, select the ‘Department data card’ under the edit form. Then insert the below expression on the Default property of the Department data card.
Default = {
    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Id: LookUp(
        Departments,
        Title = "IT",ID),
    Value: "IT"
}

Where,

  • ‘@odata.type’: “#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference”: While working with the SharePoint lookup field we need to insert this connector query.
  • Departments: The SharePoint list name
  • Title, ID: The name of the SharePoint list column
  • IT”: We set the lookup value i.e., IT as the default value
Power Apps Combobox Default Item using SharePoint Lookup Field
Power Apps Combobox Default Item using SharePoint Lookup Field

We can see, it is displaying the lookup item, i.e., ‘IT‘, as the default item within the above combo box control of the Power Apps edit form. Now we can fill out the form, submit it, and save the submitted data to the SharePoint list (i.e., Workers).

See also  Power BI Pie Chart Conditional Formatting

For this, set the edit form’s Default mode as New. Then add a Save icon to the edit form and insert the below formula on the save icon’s OnSelect property.

OnSelect = SubmitForm(Form1); ResetForm(Form1); NewForm(Form1)

Where Form1 is the name of the Power Apps edit form.

Power Apps combo box set default value lookup field
Power Apps combo box set default value lookup field

Our Power Apps form is now complete, with a default lookup value in the combo box control. When a user enters data into the form and clicks the save icon, the data is saved to the SharePoint list.

This is how to set the default value from the SharePoint lookup field in the Power Apps combo box.

Read Power Apps Cascading Dropdown Control

PowerApps combo box default value based on another combo box

Here, we will see how to set a combo box default value based on another combo box selection within the Power Apps. That means when an item is selected in the first combo box, the selected value will be displayed as default in another combo box control.

To work with this scenario, we are going to use the above SharePoint lists i.e., Workers and Department. Along with these, we will use another SharePoint list named Projects that has a lookup column named Department and this lookup column use the look-up data from the Department’s Title column.

Power Apps combo box default value based on another combo box
Power Apps combo box default value based on another combo box

Using the above SharePoint lists (Workers and Projects), we will build 2 edit forms within the Power Apps like the below:

PowerApps combo box default value based on another combo box
PowerApps combo box default value based on another combo box

Now, select the Department Datacard value (i.e., the combo box control) on the second Power Apps edit form(i.e., Projects) and insert the below expression on the DefaultSelectedItems property.

DefaultSelectedItems = DataCardValue9.Selected

Where DataCardValue9 is the name of the department data card value from the Workers edit form.

Power Apps Default Combo Box Value based on another Combo Box
Power Apps Default Combo Box Value based on another Combo Box

Now preview the app. We can see whenever we select any department from the first combo box control(i.e., Workers data source), it will display the default value on the second combo box control automatically (i.e., Projects).

Power Apps Combo Box default values from another combo box
Power Apps Combo Box default values from another combo box

This is how to set a Power Apps Combo Box default values from another Power Apps combo box control.

Conclusion

From this Power Apps Tutorial, we learned all about how to work with the default value(s) within the Power Apps combo box control based on different scenarios. Such as:

  • Power Apps combo box default value
  • Power Apps combo box default multiple values
  • Power Apps combo box default value from SharePoint list
  • Power Apps combo box default value text
  • Power Apps combo box default value empty
  • Power Apps combo box default value from gallery
  • Power Apps combo box default value lookup
  • Power Apps combo box default value based on another combo
  • Power Apps combo box default value variable

You may like the following Power Apps tutorials:

>