Create

You can use the Create transform to initialize an output element, set an output element to nil, or set an output element to fixed value defined by the schema.

Overview

For simple types, you cannot use the value of an input element to set the value of an output element in a Create transform.

However, you can define zero or more supplement connections between input elements and the Create transform. You can then use these input elements in a conditional expression that defines the condition under which the transform is applied.

Create transform with two supplement connections from input elements

You can use the Create transform to create the following types of output element:

Set the value of a string type output element

By default, the option Create empty is preselected. You must choose this option to initialize a single type output element.

For example, for an element that is defined in the schema model as <element name="Postcode" type="string" nillable="true" default="30567" />, you can choose any of the following options:
  • Create nil
  • Create by using a default or a fixed value that is defined by schema for target type
  • Create empty

The following figure shows the properties view for the Create transform defined for that element:

Shows the properties view for the Create transform defined for that element

For example, if the output element is defined in the schema model as <element name="Postcode" type="string" nillable="false" />, you can choose to create the output element as empty.

Create transform in the Graphical Data Mapping editor

The option to create a nil element is available only when the target is nillable.

The option to create an element with the default value is only available when the target has a default value that is defined in the schema file.

Set the value of a complex type output element

By default, the option Create empty is preselected. You must choose this option to initialize a complex output element.

Note: You can initialize or set to nil complex output elements.

When you define a Create transform to initialize a complex type output element, a nested map is created containing the complex structure elements. You configure each element within the nested map individually, that is, you initialize, set to nil, or set to a default value each individual element.

Create transform in the Graphical Data Mapping editor for a complex output element

When you initialize a complex type, you can use the nested map that is associated with the Create transform to provide values for the child element. You can define and configure each element by using transforms that do not require an input, for example the Assign transform, an xs:type transform, or the Create transform. You can also wire a supplemental input to move input values to the child elements.

Shows the nested map of the Create transform for a complex type

When you define a Create transform to set to nil a complex type output element, a nested map is created containing the complex structure elements. You can get the error Transform contains nested errors if you try to configure any element within the nested map individually.

Shows the error when you select create complex element as nil, and some elements in the nested map have transforms defined initializing or setting a specific value for the element

Specify how a simple data type element or attribute is created

You must specify how an output element or an attribute is created in the General tab of the Create transform properties view.

The following table lists simple data types with their default options preselected when you define a Create transform. It lists the options that you can choose to set the value of an output element of that type:

Table 1. Configuration choices available when you define a Create transform to set the value of an output element
Data type Default option Output element can be set to empty Output element can be set to nil (the element is defined as nillable="true") Output element can be set to fixed or default value (the default property is set in the schema)
String Create empty valid valid valid
Integer Create nil not valid valid valid
Boolean Create nil not valid valid valid
date Create nil not valid valid valid
dateTime Create using default or fixed value defined by schema for target type not valid not valid valid
double Create using default or fixed value defined by schema for target type not valid not valid valid
float Create using default or fixed value defined by schema for target type not valid not valid valid
hexBinary Create empty valid valid valid
int Create using default or fixed value defined by schema for target type not valid not valid valid
time Create using default or fixed value defined by schema for target type not valid not valid valid

For example, for the following schema definition of an output element:

<element name="NewAddress" type="boolean" nillable="true" />

When you define a Create transform to set the value of a Boolean element, you can create the element as nil.

Shows the properties of a Create transform

For example, for the following schema definition of an output element:

<element name="NewAddress" type="boolean" nillable="false" />

When you define a Create transform to set the value of a Boolean element, you can specify a fixed value, and the choice is preselected.

Shows the properties of a Create transform

Define when the transform is applied at run time

You can define multiple connections between input elements and the Create transform. You can then use these input elements in a conditional expression that defines the condition under which the transform is applied. If the condition evaluates to true, the transform is applied.

Note: You can use only inputs that are connected with a supplement connection to the transform.

To define the conditional expression, you can define an XPath expression or a call to a static method on an imported Java™ class. You can also create a complex expression comprising XPath, Java and extension functions such as iib:getUserDefinedProperty("propertyname").  

You configure the expression in the Condition tab that is available in the Properties page of the transform.

For more information, see Configuring the properties of a transform, Defining an XPath conditional expression for a transform and Defining a Java conditional expression for a transform.