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:

  1. 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.

    Figure that shows map with the input and the output message assembly.

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

    Figure that shows the For Each transform defined.

    The Move transform between the input and the output Properties tree will display an error. Continue with the steps to remove the error.

  3. Delete the Move transform, and then connect with a supplement connection the input Properties tree to the For Each transform.

    Figure that shows the supplement connection between the Properties tree and teh For each transform.

    Figure that shows map with the different types of inputs to the For Each transform.

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

    Figure that shows the nested map with a Move transform between the input and the output Properties tree.

  5. 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.

    Figure that shows the Cardinality tab configure with a set of indexes.

  6. 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.

    Figure that shows map with an additional input element.

  7. Select the For Each transform to open the nested map. Then, define the transformation logic inside the For Each nested map.

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.

Figure that shows map with an If transform.

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

Figure that shows map with If nested map.

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.

Figure that shows map with the input and the output connections to an Else transform.

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

Figure that shows map with the transformation to be run when the Else is applied.

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

Figure that shows the For Each nested map transformation logic.