Like Mapping

Like mapping is useful in automatically mapping complex elements that are of different types but contain equivalent content.

For instance, an application may have two different types VisitorDetails and PatientDetails that share some commonly named children. Performing a like mapping between these two objects is the equivalent of manually mapping all the same named simple type content from the source list to the target list.

It is possible to perform like mapping between arrays of complex types. In this case the equivalently-named child content mappings implied by the like mapping are applied to each element in the array according to the chosen array mapping strategy. If there are nested child arrays that would be like-mapped then the array mapping strategy is selected separately for each.

A like mapping scans the target element tree looking for the same named content in the source tree. Initially, all equivalently-named child objects get mapped regardless of their type. If the objects are of different types, the mapping shows an error decoration. You can fix the problem in the BOM definition by excluding certain target child elements from the mapping. The overall strategy for handling mappings into the children of complex type target data is to create the target element if it does not exist prior to performing assignment to the child element. If the target parent element already exists then the assignment is made to the child of the existing element. For mappings from children of source items, the assignment is only performed if the parent itself has a value. If the parent element is not assigned, then the target element remains unchanged.
Note: Like mapping is case-insensitive for the names of child objects.
Like mappings are fully recursive, mapping similarly named composite objects that are within a particular target being mapped. However, only the child objects that are at the same level are included in the like mapping.

If there are nested child arrays that would be like-mapped then the array mapping strategy is selected separately for each array.

To configure a like mapping, drag an element from the source list or LHS and drop it on a corresponding element in the target list or RHS and right-click the mapping and select Map Like-Named Child Content from the context menu. The child elements with the same name and object type are automatically mapped.


Map Like-Named Child Content is an option available on the context menu of a mapping.


Once you map like-named elements, the mapping in child elements is shown in gray lines.

If you do not want a few child elements mapped with like-named child elements, right-click the mapping at the parent level, and select Open Like-Mapping Exclusion List. Manage Like-Mapping Exclusion List dialog opens, which lists all the like-mapped elements.
The exclusion list displays all the mapped child elements. You can select elements here to exclude them from mapping.