Hey it’s Davide here, the Baserow dev
In the next release of Baserow we will be adding automatic null coercion/replacement for arguments passed to Baserow formula functions.
We are asking for feedback on this change.
Please let us know if it will cause you problems or if you are all for it.
Where do null values come from currently
In the following situations it is possible to introduce nulls into a Baserow formula:
- A date field with no date selected
- A single select field with no single select selected
- A text/long text/email/telephone/url field which has been explicitly set to null by a manual API call.
- Some formula functions like
todatewith an invalid date string as argument,
date_intervalwith an invalid interval as argument
Examples of the proposed change
null + 'a' = null
null + 'a' = 'a'
null + date = null
null + date = date
We want the Baserow formula language to be easily used and understood by non-technical users. Right now there is confusion introduced by null and how it interacts with non null values.
We hope that by adding automatic null coercion we can make the formulas behave in a more intuitive manner when dealing with null values and also reduce the boilerplate you need to write when working with nulls.
Workarounds for maintaining old behavior
If you really want to continue with the old behavior then please:
Let us know why it is useful for you by replying below
You can use the
isnull function to detect null values before they are passed into functions. You can then choose what you would like the output to be using the if function.
Not all functions will automatically replace nulls with blank values, the following do not:
- when_blank (will soon be renamed to
For some types of data there is no sensible blank default to swap nulls with, so we do not. These are:
- Single selects
So you will continue to see the following behavior:
null date + date_interval('1 day') = null date
get_single_select_value(null single select) = null text
We’ll also introduce a new
We have introduced the new
isnull function which lets you detect null values explicitly.
The main difference with
isblank is that
true also for empty strings, a number 0 or a date_interval(‘0 hours’), while
true only if the function returns null or for empty cells.