Liquid Studio Documentation
Data Mapping / Data Mapper Functions / By Category / Type / DefaultIfNull
In This Topic
    DefaultIfNull
    In This Topic

    Function Name
    Default If Null
    Category
    Type
    Icon
    Cast
    Description
    If the Value input contains items then they are passed to the Output.
    However if the Value input is empty, then the items from Fallback are passed to the Output.
    Inputs
    Value

    0-n items (values or nodes)
    If the Value input contains any items then they are passed to the Output.
    If the Value input is empty then the values in the Fallback input passed to the Output.

    Fallback 0-n items (values or nodes)
    The items are only passed to the Output if the input Value contains no items.
    The type must match (or be castable to) the type of the input Value.
    Outputs
    Output 0-n items (reflects the type of the input Value)
    The items read from the Value or Fallback Inputs.
    Properties
    Name Set a name for the function

    Usage

    Allows a default value or sequence of values to be used in the event that the value read is null or an empty sequence.

    Typically used when dealing with data sources that contain a value that is optional (i.e. a database value that is nullable). The component allows a default value to be used, so instead of the source value returning null (an empty sequence) it could be made to return a default value.

    i.e. If the HomePhone field in the database is null the string value '[UNKNOWN]' will be used instead.

    If the input Value is a primitive value then provided to Fallback must be the same type or castable to the type used in Value.

    If the input Value is a complex node then the Fallback input must be of the same type, i.e.  if Value is an Address node, then Fallback must also be an Address node.

    The type of the Output mirrors the type of the input Value.

    See Also

    Data Mapping