How to Check If Power Apps Dropdown is Empty?

Power Apps is a powerful platform developed by Microsoft that allows users to create custom business applications using different types of control like Text inputs, Dropdown, Forms, Gallery controls, etc.

While working with the dropdown control, we sometimes need to validate if a dropdown is empty or not in Power Apps; if it is empty, we perform some actions (like displaying any notifications, disabling buttons, etc.) according to it.

We can use the IsEmpty() or IsBlank() function in the Power Apps Dropdown Control for such cases.

In this Power Apps article, I will show you how to check if Power Apps Dropdown is empty using simple examples.

How to Check If Power Apps Dropdown is Empty

Let me show you how to check the empty Power Apps dropdown with two scenarios.

Scenario-1:

In Power Apps, there is a Dropdown control and a Text label control. If the dropdown has some records, the text label displays the text like “Dropdown has a value.”

Similarly, if the dropdown has no value or is empty, the text label displays the text like “Dropdown is empty.”

Have a look at the below screenshot for the output:

Power Apps Check If Dropdown is Empty

To achieve it, follow the below-mentioned steps. Such as:

1. In the Power Apps Screen, Insert a Dropdown control and set its Items property to the code below.

Items = ["Not Started", "In Progress", "Completed"]
PowerApps Check If Dropdown is Empty

2. Then, insert a Text label control and set its Text property as:

Text = If(
    IsBlank(drp_Items.Selected),
    "Dropdown is empty",
    "Dropdown has a value"
)

Where,

  • drp_Items = Power Apps dropdown name
Power Apps Check If Dropdown Control is Empty

3. Once your app is ready, Save, Publish, and Preview the app. The text label displays the text like “Dropdown has a value” because the dropdown has some values.

PowerApps Check If Dropdown Control is Empty

4. However, if the Dropdown control has no values or the dropdown is empty, then the text label displays the text like “Dropdown is empty” like below.

See also  Power Apps Modern Link Control [Detailed Tutorial]

This way, you can check if the dropdown is empty in Power Apps.

Check If Dropdown Control is Empty in Power Apps

Scenario-2:

I have a Power Apps New Form with the SharePoint list records [Expense Tracker], and inside this is a dropdown control containing the choice field items [Expense Type].

Also, a button control [Submit] is under the Power Apps form, as shown below.

Whenever the user enters a new record in the Power Apps form, the dropdown control selects the first value as a default value. But, this is not the right way to select the value in the dropdown.

For that, I have added a blank value to the dropdown control in the first place, like below.

Check If Dropdown Control is Empty in PowerApps

Additionally, if the user does not select any value from the dropdown, the label text will display a message like “Please Select the Expense Type,” and the button control will be disabled.

When the user selects any value from the dropdown control, the text message disappears, and the button control is enabled. Refer to the below screenshot:

Check If the Dropdown Control is Empty in Power Apps

To work around this example, follow the below steps.

1. On the Power Apps Screen -> Insert an Edit form control and set its DataSource property as:

DataSource = 'Expense Tracker'

Where,

  • ‘Expense Tracker’ = SharePoint Online List
Check If a Dropdown Control is Empty in Power Apps
Note: Whenever you want to submit the new record from Power Apps form to the SharePoint list, make sure you need to set its DefaultMode property as "FormMode.New"
How to Check If Dropdown Control is Empty in Power Apps app

2. To add a blank value to the dropdown control, select the dropdown and set its Items property using the below code.

Items = Ungroup(
    Table(
        {myDropdownOptions: Table({ExpenseType: Blank()})},
        {myDropdownOptions: Choices([@'Expense Tracker'].ExpenseType)}
    ),
    "myDropdownOptions"
)

Where,

  • Blank() = This Blank is a placeholder for “no value” or “unknown value”
  • ExpenseType = SharePoint list choice field
Check If a Dropdown Control is Empty in PowerApps

3. Then insert a Text label under the dropdown control and set its Text and Visible property to the code below.

Text = "Please Select the Expense Type"

Visible = IsBlank(drp_ExpenseType.Selected.Value)

Where,

  • drp_ExpenseType = Power Apps dropdown name
How to Check If Dropdown Control is Empty in Power Apps

4. Next, insert a Button control [Submit] and set its OnSelect property as:

OnSelect = SubmitForm(frm_Records);
ResetForm(frm_Records)

Where,

  • frm_Records = Power Apps form control name
How to Check If Dropdown Control is Empty in PowerApps

5. Now, you must set the Button control’s DisplayMode property. For that, follow the below code,

DisplayMode = If(
    drp_ExpenseType.Selected.Value =Blank(),
    DisplayMode.Disabled,
    DisplayMode.Edit
)
How to Check If the Dropdown Control is Empty in Power Apps

6. Finally, Save, Publish, and Preview the app. If the dropdown is empty or the user does not select any value from the dropdown, then he/she will get the error message, and the button control is not enabled.

How to Check If a Dropdown Control is Empty in PowerApps

7. Whenever the user selects any value from the dropdown, the message will disappear, and the button will be enabled. Once you submit the new record, it will be added to the SharePoint list below.

How to Check If the Dropdown Control is Empty in PowerApps

This is how we can work with the Power Apps: check if the dropdown is empty.

See also  How to Count Rows in Power Apps Collection?

Also, you may like some more Power Apps articles:

I trust this Power Apps tutorial taught in detail information about the Power Apps check if the dropdown is empty with simple and real-time scenarios.

>