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.
- An empty element. For more information, see Initializing a simple or complex output element by using the Create transform.
- An element with
xsi:nil="true"
, also called a nil element. For more information, see Choosing an XPath conditional expression that tests for a nil value in a transform. - A simple type element with a default value that is specified by the schema. For more information, see Setting the value of a simple output element to a default or fixed value.
- A complex element with child elements populated by using the Assign transform or the Move transform from supplemental wired inputs.
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.
- 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:
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.
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.
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.
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.
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.
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:
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.
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.
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.
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.