Excerpt |
---|
The IFNULL function writes out a specified value if the source value is a null. Otherwise, it writes the source value. Input can be a literal, a column reference, or a function. |
- The
NULL
function generates null values. See NULL Function. - The
ISNULL
function simply tests if a value is null. See ISNULL Function. - Null values are different from missing values.
- For more information on null values, see Manage Null Values.
D code |
---|
derive type:single value:IFNULL(my_score,'0') as:'final_score' |
Output: Generates a new column called, final_score
, which contains the value 0
if the value in my_score
is a null.
D code |
---|
derive type:single value:IFNULL(column_string, computed_value) |
Argument | Required? | Data Type | Description |
---|
source_value | Y | string | Name of column, string literal or function to be tested |
output_value | y | string | String literal value to write |
source_value
Name of the column, string literal, or function to be tested for null values.
- Missing literals or column values generate missing string results.
- Multiple columns and wildcards are not supported.
Required? | Data Type | Example Value |
---|
Yes | String literal, column reference, or function | myColumn |
output_value
The output value to write if the tested value returns a null value.
Required? | Data Type | Example Value |
---|
Yes | String or numeric literal | 'Null input' |
Example - IF* functions for data type validation
Include Page |
---|
| EXAMPLE - IF Data Type Validation Functions |
---|
| EXAMPLE - IF Data Type Validation Functions |
---|
|