Setting null values in a message in the MRM domain

To set a value of an element in an output message, you normally code an ESQL statement similar to the following:

SET OutputRoot.MRM.Elem2.Child1 = 'xyz';  

or its equivalent statement:

SET OutputRoot.MRM.Elem2.Child1 VALUE = 'xyz';  

If you set the element to a non-null value, these two statements give identical results. However, if you want to set the value to null, these two statements do not give the same result:

  1. If you set the element to NULL using the following statement, the element is deleted from the message tree:
    SET OutputRoot.MRM.Elem2.Child1 = NULL; 

    The content of the output bit stream depends on the physical format:

    • For an XML element, neither the XML tag or attribute nor its value are included in the output bit stream.
    • For a Delimited TDS element, neither the tag (if appropriate) nor its value are included in the output bit stream. The absence of the element is typically conveyed by two adjacent delimiters.
    • For a CWF or Fixed Length TDS element, the content of the output bit stream depends on whether you have set the Default Value property for the element. If you have set this property, the default value is included in the bit stream. If you have not set the property, an exception is raised.

    This is called implicit null processing.

  2. If you set the value of this element to NULL as follows:
    SET OutputRoot.MRM.Elem2.Child1 VALUE = NULL;
    the element is not deleted from the message tree. Instead, a special value of NULL is assigned to the element. The content of the output bit stream depends on the settings of the physical format null-handling properties.

    This is called explicit null processing.

Setting a complex element to NULL deletes that element and all its children.

Related concepts
Message flows overview
ESQL overview
Message modeling
Custom wire format: NULL handling
XML wire format: NULL handling
TDS format: NULL handling
Related tasks
Querying null values in a message in the MRM domain
Designing a message flow
Defining message flow content
Managing ESQL files
Developing message models
Related reference
Compute node
Database node
Filter node
ESQL reference
SET statement