How to Add a Blank Value to a Dropdown List in Power Apps?

I was working with a requirement to add a blank or empty value to a Power Apps Dropdown control. For this, I researched it and got various methods to achieve this. Yes, this technique is quite interesting and easy to learn.

This article will assist you in knowing how to add a blank value to a Dropdown list in Power Apps with different scenarios and approaches.

Additionally, we will discuss inserting a blank value to the Power Apps Dropdown with the SharePoint List distinct value.

How to Add a Blank Value to a Dropdown List in Power Apps

Here, We will see how to add an empty value in the Power Apps Dropdown control with different scenarios.

  • The screenshot below represents a Power Apps Dropdown control. The dropdown values are retrieved from a Sharepoint List (Product Info).
  • The Dropdown control always displays the first choice value from the SharePoint list. Nevertheless, I prefer to have a blank or empty value in the dropdown control each time I open the application.
  • For example, the dropdown control typically displays the value as Bread. I want to set a blank value (the default value) in place of the Bread value so that when I open the application, the dropdown control will display a blank choice, as seen below.
Power Apps dropdown add empty value
  • Below is the SharePoint List (Product Info). This list contains three columns:
ColumnData type
IDNumber
TitleSingle line of text
Product LocationSingle line of text

Refer to the image below:

PowerApps dropdown add empty value
  • To set a blank value to the dropdown control, you must create a PowerApps Collection on Screen’s OnVisible property and then bind this created collection to the Dropdown control.
  • First, on the Power Apps screen, go to the screen’s OnVisible property and apply the code below:
OnVisible = ClearCollect(
    ProductsWithBlank,
    {Product: Char(160)}
);
Collect(
    ProductsWithBlank,
    'Product Info'.Title
)

Where,

  1. ProductsWithBlank = Provide a Collection name
  2. Product = Specify a header name of the collection.
  3. ‘Product Info’ = SharePoint list name
  4. Title = Specify the column that you want to display in the dropdown control
  • To avoid the dropdown bug where blank entries appear with a smaller height (which can be hard to select on small screens, such as phones). So, to avoid this, you can work around this [Char(160)] by defining the name as a ‘non-breaking space.’
PowerApps drop down add empty value
  • Next, Select the dropdown control and set its Items property to the collection as:
Items = ProductsWithBlank
How to add an empty value in PowerApps dropdown control
  • Now save and publish the app. Once you reopen the app again, then you will see a blank value appear in the dropdown control.
See also  Power Apps Naming Conventions [Standards & Guidelines]

This way, we can add a blank value to the Power Apps Dropdown control.

Add Blank Value to Power Apps Dropdown with SharePoint List Distinct

In this scenario, we will discuss adding a blank value to the Power Apps Dropdown with the SharePoint List distinct value.

Example – 1:

In Power Apps, there is a Button control [Create Collection & Add Blank to Dropdown] and a Dropdown control. Upon clicking the button, the user will create a collection with a blank value and add it to the dropdown menu, as demonstrated below.

add a blank to powe apps dropdown

To achieve this, follow the steps below:

  • Below is a SharePoint list named Products. This list has two columns:
    • ID = Number
    • Title = Single line of text
add blank to dropdown powe apps
  • In Power Apps, insert a Button and set its Text property as:
Text = Create Collection & Add Blank to Dropdown
  • Select the button and apply the code below on its OnSelect property:
OnSelect = ClearCollect(
    colBlank,
    {item: Blank()}
);
ClearCollect(
    colBlankValue,
    colBlank,
    Distinct(
        Products,
        Title
    )
)

Where,

  1. colBlank, colBlankValue = Collection names
  2. Products = SharePoint list name
  3. Title = SharePoint column name

In this case, a collection with a blank value is created, and the blank value is then added to another collection with a distinct SharePoint value.

NOTE:

We can use the OnStart or OnVisible properties of the App or the Screen to create the collection in addition to the Power Apps Button’s OnSelect property.
dropdown blank value power apps
  • Next, add a Dropdown control and set its Items property to the specific collection as:
Items = colBlankValue

As seen below, ensure the Dropdown Value property is also set to Value.

dropdown blank value in power apps
  • At last, Save, Publish, and Preview the app. Click on the button and then expand the dropdown menu. The blank value has been added to the Power Apps dropdown control.
See also  Power Apps Modern Link Control [Detailed Tutorial]

Example – 2:

A Power Apps Dropdown control displaying every vendor name from the SharePoint list can be seen in the image below. The dropdown menu didn’t have an empty value before, but it will look like the second image after adding one.

How to Add a Blank Value to a Dropdown List in Power Apps

To workaround with this, follow the instructions below:

  • There is a SharePoint list called Products having these many columns below:
ColumnData type
IDNumber
TitleSingle line of text
VendorChoice [APPLE, SAMSUNG, DELL, HP, LENOVO]
Customer NameSingle line of text
Add Blank Value to Power Apps Dropdown with SharePoint List Distinct
  • Next, in Power Apps, add a Dropdown control and set its Items property as:
Items = Distinct(Products,Vendor.Value)

Where,

  1. Products = SharePoint List Name
  2. Vendor = SharePoint Choice Column

You cannot see a blank value once you preview the app and expand the dropdown menu. It will only show you the choices except the empty value.

Add a Blank Value to a Dropdown List in Power Apps
  • To add a blank value to the Power Apps dropdown control, apply the formula below on its Items property:
Items = Ungroup(
    Table(
        {Items: Table({Result: Blank()})},
        {
            Items: ForAll(
                Distinct(
                    Products,
                    Vendor.Value
                ),
                {Result: ThisRecord.Value}
            ).Result
        }
    ),
    "Items"
)
  • Also, ensure the Dropdown Value property is set to Result, as shown below.
add blank value to dropdown power apps
  • Finally, Save, Publish, and Preview the app. Expand the dropdown menu, and you can see a new blank value has been added, as shown in the figure.
add blank value to dropdown powerapps

This way, we can add blank values to the Power Apps Dropdown with a SharePoint list of distinct items.

Conclusion

The placeholder “blank” stands for “no value” or “unknown value.” If the user has not selected anything, the Selected property of the Power Apps Dropdown control is blank.

See also  PowerApps Find Function With Examples

Now, from this tutorial, I hope you have some ideas and are confident about adding a blank value to a Power Apps Dropdown menu with various techniques.

Moreover, you may like some more Power Apps tutorials:

>