Choosing a transform to set the value of a simple type output element

You can use different transforms, such as the Assign transform, the Create transform, the Move transform, or the xs:type transform, to set the value of an output element.

Procedure

Complete the questionnaire to identify the transform that you can use to set the value of an output element:

  1. Do you want to set the value to a fixed value?

    Use the Assign transform.

  2. Do you want to initialize the output element, that is, do you want to create an empty structure?

    Use the Create transform to initialize a string output element or a hexBinary output element.

  3. Do you want to create a nil output element?

    Use the Create transform and verify that the output element is defined as nillable="true" in the schema.

  4. Do you want to set the output element as nil by using an input element with a value of nil?

    Use the Move transform. Verify that the input element is defined as nillable="true" in the schema. Ensure that the value of the input element is nil.

  5. Do you want to set the output element to a default value?

    Use the Create transform and verify that the output element has a default value set in the schema.

  6. Do you want to set the output element with input from a database column?

    Use the Select transform to obtain the database input value. Then, in the nested map that is associated with the Select transform, use the Move transform to set the value of the output element.

  7. Do you want to set the value of the output element with the value of an input element? Do the input element and the output element have the same type associated? Do you want to cast the input value to the type of the output value?
    • When the input and output element have the same type, use the Move transform.
    • When the input and output element have different data types, use the xs:type transform.
  8. Do you want to calculate the value of the output element by using the value of one or more input elements?
    To set an output element with a string data type or hexBinary data type, use any of the following transforms:
    • Concat
    • Normalize
    • Append
    • Substring
    • fn:string-join
    • Custom XPath
    • Custom Java
    • Custom ESQL
    To set up an output element with any other data type, use any of the following transforms:
    • Any supported XPath functions, for example, fn:round
    • Custom XPath
    • Custom Java
    • Custom ESQL
  9. Do you want to apply the transform always? Do you want to apply the transform when a condition based on input data occurs?

    Define a conditional expression for the transform you choose. This expression determines when the transform is applied. For more information, see Defining an XPath conditional expression for a transform.

Results

Table 1. Setting the value of a simple output element
  Number of input elements that are required to set the value of the output element Transforms to set a string data type, or a hexBinary data type Transforms to set other simple data types
Set the output element with a fixed value 0 Assign Assign
Initialize the output element 0 Create not valid option
Set the output element as nil 0 Create

Condition: The output element must be defined as nillable="true" in the schema.

Create

Condition: The output element must be defined as nillable="true" in the schema.

Set the output element as nil by using a nil input element 1 Move

Condition: The input element must be defined as nillable="true" in the schema.

Move

Condition: The input element must be defined as nillable="true" in the schema.

Set the output element with a default value 0 Create

Condition: The output element must have a default value set in the schema.

Create

Condition: The output element must have a default value set in the schema.

Set the output value from a database table column 1..N Select transform to obtain the database input value and Move transform to set the value Select transform to obtain the database input value and Move transform to set the value
Copy the value of the input element to the output element (both elements have the same data type) 1 Move Move
Copy the value of the input element to the output element (elements have different data types) 1 xs:type xs:type
Calculate the value by using the values of multiple input elements 1..N Concat, Normalize, Append, Substring, fn:string-join, Custom XPath, Custom Java, Custom ESQL XPath fn: functions, Custom XPath, Custom Java, Custom ESQL

What to do next

Learn about the transforms. For more information, see Transform types in the Graphical Data Mapping editor.