Graphical mapping using functions
To perform data transformation you can add a function to complete a mapping.
- Right-click the element in the target document tree where the function is required.
-
Click Add Function.
The mapping functions editor is loaded and split into two areas. On the left side, the available functions are shown. You can add them to the function modeling editor. On the right side, the function modeling editor is shown. You can connect the functions to the source and target documents.On the mapping function editor window, each mapping context created is represented by a resizable mapping scope container. If there is no container a new context is not created. You can create a new context in these ways:
- Dragging a source element from the source document tree.
- Use the context (right-click) menu to create a constant starting point.
Alternatively, you can add a user-defined function from the editor's left panel. Select Template Functions > create-custom.When a user-defined function is defined as a starting point it is created without any input parameters. A single mapping to the target is shown as a single mapping container with a grey dashed line from the source to the target. It represents the direct mapping between the source element and target element with no function.Where multiple mappings exist to the target, multiple mapping containers are displayed containing the individual scope of the mapping. You can add one or multiple functions to each scope of graphical mapping. Or merge the individual scopes into a single scope. For example if mapping multiple source elements to be concatenated into a single element in the target. -
Create a single function scope.
Drag the function scope starting point from its mapping scope container into the container where the scope is to be merged. A function scope starting point is a source element indicated by the lock icon. The container where the scope is to be merged is a source element. The scope being dragged into becomes the starting point for the scope of the merged function.
When a function is added to any mapping scope the direct connection, grey dashed line, is removed.
A created mapping within the graphical mapping view shows the selected target element and each of the sources mapped with it. A lock symbol indicates that you cannot remove the target element and each of the sources from the function modeling editor view.
You can view the XSLT code that is generated for the function scopes by clicking the XSLT Viewer tab. If a function is invalid, the XSLT Viewer tab is disabled, and the XSLT code is not generated. Invalid functions cannot be saved.