·
3 min read

Power Fx: Experimental error handling update

One of our most popular experimental features is “Formula-level error management.”  With good reason, it supports both working with the inevitable errors that crop up in an app and writing Blank (Null) values to databases.

We are getting close to finishing this feature and enabling it for everyone to use.  Before we do, we have a few more changes to make, and in 3.21101 we are making a small change in the Blank handling of the Value functions.  We don’t blog on every change we make to experimental features, but these were subtle enough that we wanted to call them out.   We are also introducing a new place to find out about experimental features and provide feedback.

Note that changes described here are only for apps where the experimental “Formula-level error management” switch is turned on.  Most apps do not use this switch and will not be effected in any way.

New home for experimental features

Before I go on, we have a new home!  There is a new area in the Power Apps community forum for experimental features and a subarea specifically for Error handling.

We will post details and documentation on experimental features here.  Experimental features have always been a little different and we don’t normally add these features to the documentation until they reach preview.

We will also be monitoring this forum for your feedback.  We love feedback but it is especially important for experimental features as we make changes .

Blank handling

We are making a very subtle change to Blank and empty string handling in the Value functions (Value, DateValue, ColorValue, etc).  Non Blank behavior is not changing.  An app would need to be specifically written to the old behavior to notice a difference, which is not common.

If anything we are removing some errors that you may not have known you had.   We are changing the Value, DateValue, and other Value functions to no longer return errors if an empty string is passed in.  You may have noticed these errors popping up this past spring after we started reporting more errors; this change will remove these errors.

We are also changing the Value function to pass through a Blank instead of converting it to a numeric zero.  This will help with round tripping a Blank from a database, through a text based control, and back out to the database.  If the old behavior is desired, one can use the formula If( <value> = Blank(), 0, Value( <value> ) ).  The Coalesce function can also be used but would return 0 for empty strings too (which may be fine depending on your scenario).

There are two Power Fx principles that we are reinforcing with these changes:

  • Power Fx functions treat Blank and an empty string as the same thing.  The IsBlank function started this trend and the Coalesce function followed its lead.  The change being made here extends this to the Value functions.  This is a good thing as mixing these two is common and being too strict about differentiating them can lead to unforeseen problems.  If the distinction is important, Power Fx’s = and <> operators properly differentiate Blank from an empty string.
  • Power Fx functions pass through Blank values if the value does not need to be interpreted.  This is true even if the data type changes, as all data types are nullable.  The change being made here extends this to the Value function.  Soon, but not today, we plan to change numerical functions that need to interpret the value to treat Blank as 0.  For example, Cos( Blank() ) should and will one day return 1.

In summary, this is what is changing now:

Function Inputs
Before changes After changes
Blank Empty text (“”) Blank Empty text (“”)
ColorValue Blank <error> Blank Blank
DateTimeValue Blank <error> Blank Blank
DateValue Blank <error> Blank Blank
TimeValue Blank <error> Blank Blank
Value 0 <error> Blank Blank

Feedback

Please!  Use our new home to let us know what you think of these changes.  There is a reason these changes are under an experimental switch – we are experimenting – only you can let us know if we have it right.

You wouldn’t believe the hours we spent debating these detailed semantics.  We are trying to stay true to Excel but also recognize that we are different, that we must work well with databases that treat Blank as a first class citizen.  Power Apps we uses a variety of controls, like the TextInput control, to read and write numbers as text, requiring a smooth treatment of Blanks across data types.