Assign

You can use the Assign transform to set the value of an output element to a constant or fixed value.

Overview

The Assign transform sets a value that can be a fixed value or it can be the result of a function that has no input; for example, a current date function.

You cannot use the value of an input element to set the value of an output element with the Assign transform.

The output element is set to a constant value.

The output element must be a simple type element.

For more information about assigning a value to an output element, see Setting the value of an output element to a simple data type.

Assign a value

You must assign a value in the Value field that is located in the General tab of the Assign transform Properties view.

If you do not specify a value, an empty element is created.

This figure shows the general tab in the Properties view for the Assign transform.

Define when the transform is applied at run time

You can define multiple connections between input elements and the Assign 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.

To add inputs to the transform, you can define supplement connections between input elements and the Assign transform.

Figure that shows supplement connections to an Assign transform

When you define more connections, you can configure the following properties to define how those inputs are displayed in the message map:
  • Sort: You can sort the inputs to the transform by ascending order, descending order, case order, or data order.
  • Order: You can display the order of input connections to a transform. You can reorder them.
Note: You only can sort and order inputs that are connected with a primary connection to the transform.

Default values

The following table lists the default values set when you use the Assign transform:
Table 1. Default values set by using the Assign transform
Type Default value
string Empty string
dateTime 2002-01-01T11:00:00
Boolean false
decimal 0.0
double 0.0
hexBinary 00
long 0
duration P1Y
time 00:00:00
date 2002-01-01