This topic contains sections marked as revised for this release

WebSphere Message Brokers
File: ar25279_
Writer: Cerys Giddings

Task topic

This build: July 31, 2007 21:36:36

Configuring a repeating source and a non-repeating target

To map a repeating source element to a non-repeating target element, drag elements between the Message Mapping editor Source and Target panes. The following items appear in the Spreadsheet pane:

The first occurrence of the source field is mapped to the target field. The ‘for’ row specifies that a loop is to be iterated for the specified repeating element. The ‘if’ and ‘condition’ rows restrict the logic to a single occurrence of the repeating element (see Configuring conditional mappings for more information on conditional logic in a mapping node).

  1. To map an occurrence other than the first, change the expression in the ‘condition’ row to msgmap:occurrence($source/…) = n, where n is the occurrence that you want to map.

    If the repeating source field is within one or more repeating structures, a hierarchy of ‘for’, ‘if’, and ‘condition’ rows is placed in the Spreadsheet pane, one for each level of repetition.

  2. If the source field contains a numeric data type, mapping all occurrences of a repeating source field to a non-repeating target results in the sum of all the source elements. Perform this mapping by selecting the source element and target element and clicking Map > Accumulate.
    This action sets the following value in the Spreadsheet pane for the target element:
    fn:sum($source/…)

    The result of the accumulate action is a numeric value. If your target has a different data type, then you must cast the result to the appropriate type for the selected target. For example, if your target is xs:string type, you must alter the results of the accumulate action from fn:sum($source/x/y/z) to xs:string(fn:sum($source/x/y/z)), in order to cast the result to the correct data type for your target.

    You cannot map different occurrences of a repeating source element to different non-repeating target elements.

Related concepts
Message Mapping editor
Creating message mappings
Related tasks
Configuring conditional mappings
Related reference
Message Mapping editor Source pane
Message Mapping editor Target pane
Message Mapping editor Spreadsheet pane
Message mappings
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:36:36

ar25279_ This topic's URL is: