IFBLANK

IFBLANK(value, blank_branch)[source]

Returns a specified value if the input value is blank, otherwise returns the value.

This function checks whether value is blank (empty or null). If it is blank, the function returns blank_branch; otherwise, it returns the value of value. Both singular values and arrays are supported. This is useful for providing default values when data may be missing.

Parameters:
  • value (Operand) – The value to check if blank.

  • blank_branch (Operand | int | str | float | bool) – The value to return if value is blank. Must be compatible with the data type of value (or NULL).

Return type:

Formula

Returns:

Either blank_branch if value is blank, or the original value otherwise.

Raises:
  • ValueError – If value and blank_branch have incompatible data types.

  • ValueError – If both value and blank_branch have data type NULL.

Examples

IFBLANK(order["discount"], order["default_discount"])
# Returns the discount if present, else default_discount

``value`` — accepted types

  • BOOLEAN

  • BOOLEAN_ARRAY

  • BOOLEAN_MAP

  • DATE

  • DATETIME

  • DATETIME_ARRAY

  • DATETIME_MAP

  • DATE_ARRAY

  • DATE_MAP

  • DECIMAL

  • DECIMAL_ARRAY

  • DECIMAL_MAP

  • INTEGER

  • INTEGER_ARRAY

  • INTEGER_MAP

  • NULL

  • OBJECT

  • OBJECT_ARRAY

  • STRING

  • STRING_ARRAY

  • STRING_MAP

  • TIME

  • TIME_ARRAY

  • TIME_MAP

``blank_branch`` — accepted types

  • BOOLEAN

  • BOOLEAN_ARRAY

  • BOOLEAN_MAP

  • DATE

  • DATETIME

  • DATETIME_ARRAY

  • DATETIME_MAP

  • DATE_ARRAY

  • DATE_MAP

  • DECIMAL

  • DECIMAL_ARRAY

  • DECIMAL_MAP

  • INTEGER

  • INTEGER_ARRAY

  • INTEGER_MAP

  • NULL

  • OBJECT

  • OBJECT_ARRAY

  • STRING

  • STRING_ARRAY

  • STRING_MAP

  • TIME

  • TIME_ARRAY

  • TIME_MAP

Return types

  • BOOLEAN

  • BOOLEAN_ARRAY

  • BOOLEAN_MAP

  • DATE

  • DATETIME

  • DATETIME_ARRAY

  • DATETIME_MAP

  • DATE_ARRAY

  • DATE_MAP

  • DECIMAL

  • DECIMAL_ARRAY

  • DECIMAL_MAP

  • INTEGER

  • INTEGER_ARRAY

  • INTEGER_MAP

  • OBJECT

  • OBJECT_ARRAY

  • STRING

  • STRING_ARRAY

  • STRING_MAP

  • TIME

  • TIME_ARRAY

  • TIME_MAP