PowerApps IsEmpty and IsBlank were very confusing to me when I started with PowerApps. I was used to use the terms blank and empty with different meanings from my progamming background. This article should clarify the differences and explain when to use which function.
Before we go into details. If there should be one lesson you take away from this article, it should be this:
Use IsBlank with strings and use IsEmpty with collections and tables.
IsBlank
The PowerApps IsBlank function returns true for two inputs:
- Blank()
- “” (empty string)
That’s it.
Syntax
IsBlank( Value )
Examples
IsBlank(Blank()) // Returns true
IsBlank("") // Returns true
IsBlank(" ") // Returns false
IsBlank([]) // Returns false
IsEmpty
The PowerApps IsEmpty function online evaluates to true for an empty collection or table.
Syntax
IsEmpty( Table )
Examples
IsEmpty([]) // Returns true
IsEmpty("") // Returns false
IsEmpty([""]) // Returns false
IsEmpty(Blank()) // Returns false
Validating UI Controls with IsBlank & IsEmpty
Since using IsBlank and IsEmpty is often used to valdiate mandatory data within forms, I like to show how you can check wheter a certain control is set or not.
Take a look at the table and see how to check, wheter the control was set or not.
Input control | Value check |
---|---|
Combo box | IsEmpty(ComboBox1.SelectedItems) |
Date picker | IsBlank(DatePicker1.SelectedDate) |
Drop down | IsBlank(Dropdown1.SelectedText.Value) |
List box | IsEmpty(ListBox1.SelectedItems) |
Radio | IsBlank(Radio1.Selected) |
Text Input | IsBlank(TextInput1.Text) |