Hello, I think a null value would be extremely helpful to use in a function for a formula field, as it would also expand the functionality for the if-function. The null value would be neutral and could therefore turn the if-function from an if-else-statement to a simple if-statement (so the structure would be if(bool, any, NULL)
).
I’m looking as well for this!
Using NULL values in formula fields is a great idea! Here’s a simple example showing how it enhances if-function flexibility:
IF(revenue > 1000, 'High Value', NULL)
This approach offers several benefits:
- Cleaner conditional logic
- More precise data representation
- Easier filtering and reporting
- Reduced complexity in nested conditions
The NULL value acts as a perfect neutral state when you only need to track specific conditions while leaving others undefined.
Hey @chantal @360Creators, what are your specific use cases or examples? While we see the value, we think using the functionempty
could be a workaround.
@olgatrykush you mean when_empty
right?
Haven’t gotten that to work yet.
It’s like what modbot was saying. I’ve been using this type of IF logic all the time in Airtable.
Fix
As I’ve been reviewing this discussion, I figured that you can make it work like this:
IF(field('revenue') > 1000, 'High Value','')
And if you want to do something if it has NULL/nothing/blank, then something like:
IF(field('revenue') = '', 'it is blank','it has some value')
Familarity from Airtable
It’s just that there’s this familarity from Airtable using BLANK()
IF(revenue=BLANK(),'its blank','it has something')
Which can work as well in Baserow, but it gets more difficult to read/understand later on.
IF(BLANK(field('revenue')=true,'its blank', 'it has something')
Just generally speaking, I think formulas should have the same look and feel as Airtable or Nocodb. But that’s probably quite an intense task
hey @360Creators
Yes, this one
Ronald, thank you for sharing the examples. We’ll review them and rediscuss this request to add a NULL
value.
I am running into this need too.
I want to do a max of dates obtained through lookup, those dates being computed from formulae, and being possibly optional (null). If my date computation is: if(date_exists, computed_date, '')
then the max
function will always return empty value as long as there’s 1 empty string date. I need a true null return value here (or a way to compute the max of actually computed dates - so far I don’t have a proper workaround).
Sorry for the late response! Our use case would be the following: There are three fields, status, start_date and end_date. When the status is set to started, the start_date should be filled with the curent date. When the status is set to finished, the start_date should remain the same and additionally the end_date should be set to the current date. So for the start_date for example I wanted to use a formular field with if(status=started, set current date, otherwise do nothing). I have tried to use " " as the third parameter but then the start_date gets deleted (set to " ") every time the status changes to finished.
Hey @Yam @chantal @360Creators, just wanted to check if these examples (just how to structure the formula) would work for your cases:
if(is_null(field('Number')), 0, field('Number') + 10)
if(is_null(field('Number')), '', field('Number') + 10)
Have you tried using is_null
function?
(edited/removed my post - I can’t reproduced my specific issue in a mock up database, so there must have been more to it than I thought)
We want to understand your use cases to see whether you’re trying to get a NULL
result or an empty row. If NULL
, then is_null
function should work for this.