Splitting an input message into multiple output messages
You can use a For Each transform or a Join
transform wired to the head of the output message assembly to create a map that takes a
single input message and produces multiple instances of an output message model. A typical
use of this function is message splitting, in which an input batch message is divided into
individual record messages.
About this task
When the map runs, a new message is propagated for each iteration of the For
Each or Join transform.
Procedure
Complete the following steps to split a message into multiple output messages by
using the For Each transform:
- Create a map, and add one input element to your input message assembly, and one
output element to your output message assembly.
The input message assembly must contain a repeating element. The values of
the elements for each index are used to populate each output message
instance.

- Define a For Each transform between the input element
and the head of the output message assembly.

The Move transform between the input and the output
Properties tree will display an error. Continue with the steps to remove the
error.
- Delete the Move transform, and then connect with a
supplement connection the input Properties tree to the For
Each transform.


- Select the For Each transform to open the nested map.
Then, define a Move transform between the input and the
output Properties tree.

- Optional: Return to the For Each transform, and configure the
indexes of the For Each transform for which you want to
generate an output message.
If you need to create an output message for each index of the repeating
structure, then continue with the next step.
You can configure the Input array indexes section to
select specific instances of the input array. For more information, see
Selecting the indexes of input array elements.

- Optional: If you need additional information from the input message to populate output
elements, define a supplement connection between each input element to the
For Each transform.
When you connect additional input elements with supplement connections to a
For Each transform, you can use these elements as
part of your mapping operations within the nested map.

- Select the For Each transform to open the nested map.
Then, define the transformation logic inside the For Each
nested map.
For more information, see Transform types in the Graphical Data Mapping editor.
Example
The following example shows how to define the mapping logic in a
For
Each transform after you complete steps 1 to 6:
- Each instance of the For Each transform produces an
output message.
- The repeating element H has three elements that are
used to set the values of the output message, which only has two
elements.
- An additional input element is needed as part of the transformation. This
element is used as part of the conditional expression that determines when a
set of transformations is applied.
- An If transform is used to model the conditional
mapping requirements required to set the value of the output message
elements for each index of the For Each
transform.
- When the value of the input element A is equal to the
value of the input element H1, then the
If transform is applied. Otherwise, the
transformation logic in an Else transform is
applied.
.
Complete the following steps to define the transformation logic:
Open the For Each transform nested map.
Define an
If transform between
H and
a.
- Define a primary connection between H and the
If transform.
- Define a supplement connection between A and the
If transform.
- Define a connection between the If transform and the
output element a.

Define a Move transform between H1 and
a. This operation defines the transformation logic that
the If transform performs.

Add the
Else transform:
- Define a primary connection between H and the
Else transform.
- Define a supplement connection between A and the
Else transform.
- Define a connection between the Else transform and
the output element a.

Define a Move transform between H2 and
a. This operation defines the transformation logic that
the Else transform performs.

The following figure shows the For Each transform nested map
after all the transformation logic has been implemented:
