Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

D toc
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 s
snippetBasic

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 s
snippetSyntax

D code

derive type:single value:IFNULL(column_string, computed_value)

ArgumentRequired?Data TypeDescription
source_valueYstringName of column, string literal or function to be tested
output_valueystringString literal value to write

D s lang notes

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.

D s
snippetusage

Required?Data TypeExample Value
YesString literal, column reference, or functionmyColumn

output_value

The output value to write if the tested value returns a null value.

D s
snippetusage

Required?Data TypeExample Value
YesString or numeric literal'Null input'

D s
snippetExamples

Example - IF* functions for data type validation

Include Page
EXAMPLE - IF Data Type Validation Functions
EXAMPLE - IF Data Type Validation Functions

D s also
labeltype