The REMOVE_EMPTY function removes all empty and NULL
values from a given List
.
This function takes any List
as input. It outputs another List
: the given List
, with all empty and NULL values removed.
Declaration
REMOVE_EMPTY(list) -> filtered_list
Parameters
list (required, type: List
)
A List
containing any number of items. These items can be of any type and do not need to be the same type as each other.
Return Values
filtered_list (type: List
)
The List
that results when all empty or NULL
values are removed from the given List
.
Examples
The following example takes a List
of text
types and removes all empty strings:
REMOVE_EMPTY(
[
"not empty",
"",
"also not empty",
"",
"",
"this last one isn't empty"
]
)
->
[
"not empty",
"also not empty",
"this last one isn't empty"
]
THE REMOVE_EMPTY function can parse Lists
that contain values of any type, and the data types of each instance within a list do not need to match. All empty Objects
, strings
, Lists
, and NULL
values will be removed:
REMOVE_EMPTY(
[
{ },
{ "object": "not empty" },
[ ],
[
"this",
"List",
"is",
"not",
"empty"
],
"",
"not an empty string",
1,
NULL
]
)
->
[
{
"object": "not empty"
},
[
"this",
"List",
"is",
"not",
"empty"
],
"not an empty string",
1
]
Values such as the Number
0 or the Boolean
FALSE do not count as empty values:
REMOVE_EMPTY([ 0, FALSE ]) -> [0, FALSE]
The REMOVE_EMPTY function only removes empty or NULL items from the List
given as input. If one of items within that List
is a List
or Object
that contains an empty or NULL value, the REMOVE_EMPTY function will not remove it. For example, if the REMOVE_EMPTY function is given a List
with two items: an empty List
, and a List
containing two items: NULL
and an empty List
, the REMOVE_EMPTY function will behave as follows:
REMOVE_EMPTY([ [ ], [ NULL, [ ] ] ]) -> [ [ NULL, [ ] ] ]
Note that the returned List
has only a single item, but that none of the empty or NULL
values have been removed from it.