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.

    Supported types:

    • ANY

  • 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).

    Supported types:

    • ANY

Return type:

Formula

Returns:

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

Supported types:

  • ANY

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