Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r096

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. 

D s lang vs sql

D s
snippetBasic

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:ifnull(my_score,'0') as:'final_score'

ifnull(my_score,'0')

Output: Returns the value 0 if the value in my_score is a null. 

D s
snippetSyntax

D lang syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:ifnull(column_string, computed_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