A detailed explanation of the difference between “blank”, “null” and “empty” in Power Apps.

The concept of Null, Blank, and Empty in Power Apps was different from that in C#, so I looked into it in detail.

*This article is a broken version of what is written in the official information below (7/2/2020). Please refer to the official version for reliable information.
Blank, Coalesce, IsBlank, and IsEmpty functions - Power Platform
Reference information including syntax and examples for the Blank, Coalesce, IsBlank, and IsEmpty functions.
スポンサーリンク

Summary

In Power Apps, “blank” is a provisional “no value” or “unknown value”.

For example, the Selected property of a combo box that is not selected will be blank.

In addition, Power Apps also allows bool values to have a value of blank as well as true and false.

Think of Excel.
The contents of a cell can be erased, right?

Empty, by the way, refers to a table that contains no records.

Caution:
We are currently in a period of changeover in the handling of whitespace and the like.
Storing blank values can only be used in local collections, as it may not work properly with error handling, etc. In the future, the handling of blanks and such will change.
This may change in the future.

Translated with www.DeepL.com/Translator (free version)

Contents

If you want to use “blank” as a value, use the Blank function. The Blank function assignment is like a NULL assignment.

You may be tempted to use the IsBlank function when checking for whitespace, but you should consider this. The IsBlank function is sensitive and will respond to “empty string” as well as “blank”.

If you only want to check “blank? only, create if statements with the Blank function.

if(var = Blank())

Make an if statement with the Blank function like so.

The Coalesce function looks at the arguments in order and returns a value other than the first “blank” or “empty string.
Since the Coalesce function is selfish, all arguments must be the same type of value. Do not pass numbers and strings together.

IsEmpty is the same as (CountRows() == 0). Be aware that Blank and Empty are different.

Syntax

Please refer to the respective official pages for detailed instructions.

Blank()
Coalesce(Value1[, Value2…])
IsBlank(Value)
IsEmpty(Table)

  • IsBlank(“Rainy”) ===> false
  • IsBlank(Blank()) ===> true
  • Coalesce(Blank(),1) ===> 1
  • Coalesce(“”, 2) ===> 2
  • Coalesce(Blank(),””,Blank(),””,3,4) ===> 3
  • Coalesce(“”) ===> Blank()
  • IsBlank(Blank()) ===> true
  • IsBlank(“”) ===> true
  • IsBlank(“Hello”) ===> false
  • IsBlank(Collection of some kind) ===> false
  • IsBlank(Mid(“Hello”), 17, 2) ===> false

* Since the 17th character from the center does not exist in the string “Hello”

  • IsBlank(if(false,false)) ===> true

*Because the specification of the If function is “no condition is true, no match is found, and a blank is returned if no default result is specified”.

  • IsEmpty([1,2,3]) ===> false
  • IsEmpty([]) ===> true
  • IsEmpty(Filter([1,2,3],Value>5)) ===> true

*Because there are no values greater than 5 in the array.

Finally

In Power Apps, Blank is like Null. However, the IsBlank function also responds to an empty character (“”).
The IsEmpty function is used for tables. IsEmpty(“”) is false.

Related Articles

コメント

Copied title and URL