# empty

Learn how to use the empty function in Notion formulas.
The `empty()` function returns true if its argument is empty, or has a value that equates to empty - including `0` and `false`.
1
empty(string)
2
empty(number)
3
empty(Boolean)
4
empty(date)
`empty()` accepts all data types, including strings, numbers, Booleans, and dates.

## Example Formulas

1
empty("") // Output: true
2
3
empty(0) // Output: true
4
5
empty(false) // Output: true
6
7
// Assume a row where the Name property is currently blank
8
empty(prop("Name")) // Output: true
`empty()` can be preceded by the not operator to ensure that a property or value is not empty:
1
// Assume a row where the Name property contains text
2
not empty(prop("Name")) // Output: true
3
4
// The same result can be accomplished with conditional operators
5
// (Assume the Name property contains text in this row)
6
empty(prop("Name")) ? false : true // Output: true

## Example Database

The example database below shows how you can sort sub-tasks by their parent task's due date. This pictured view is simplified for ease-of-use; view the database's All Properties tab to see every property at work.

### “Parent Due” Property Formula

1
// Compressed
2
3
4
// Expanded
5
if(
6
not empty(
7
8
),
9
prop("Parent Due Rollup"),
10
if(
11
empty(
12
13
),
14
prop("Due"),
15
if(
16
not empty(
17
prop("Due")
18
),
19
prop("Due"),
20
21
now(),
22
100,
23
"years"
24
)
25
)
26
)
27
)
This formula uses both `empty()` and `not empty()` in conjunction with multiple nested if statements in order to determine a Parent Due Date.
The entire database view is then sorted by:
1. 1.
Parent Due Date
2. 2.
3. 3.
Due Date
Notice that the formula also calls in a Parent Due Rollup property, which is actually configured to pull in the Parent Due Date content of the Parent Task:
That's right - this is a formula, which pulls in its own output (from other database rows)!
Let's work through what this formula is doing:
1. 1.
First, it checks if Parent Task is not empty. If so, we know we're dealing with a sub-task, so we output the value of Parent Due Rollup. Note that Parent Due Rollup's content is determined by the rest of the logic in this formula.
2. 2.
If Parent Task is empty, then we check if Sub-Tasks is empty as well. If so, we're dealing with a "lone" task - it's not a parent task nor a sub-task. In this case, we output its Due date value.
3. 3.
If Sub-Tasks is not empty, then we know we're dealing with a parent task. Next, we check if its Due property is not empty.
4. 4.
If it does have a date, we output that. If not, we output a standard date of now plus 100 years (using dateAdd). This ensures that parent tasks with no actual due date have a hidden "default" date, enabling sub-tasks to still be sorted underneath them as intended.