...
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
Map source and target elements as displayed in figure below (see Figure 543).
Figure 543: Map Source and Target Elements
- Click the parent node (e.g. Record) of the target element and apply the For Each for parent node (e.g. Record) of schema Source1.
- Create a local variable at Record level of the target schema. Select EMPID element of Source1 schema as the value of the variable.
- Click target element (e.g. Address) on which you want to apply the key.
- Click the Node tab displayed in the Mapping Graph Area. All tabs of the Node tab are displayed.
- Click the Textual Rules tab. The Textual Rules pane is displayed in the Mapping Graph Area.
Click the Aggregation mapping function and select the Key sub-function. The Key function is displayed in the Textual Rules pane (see Figure 544).
Figure 544: Key Function
- Place the cursor, at the first argument of key function and double-click the required key that you want to apply, from Keys in the Parameters Panel. This is the first argument for the key function.
- Place the cursor at the second argument of key function and double click the required local variable, under Local/Ancestor Variables in the Parameters Panel. This is the second argument for the key function.
- The syntax of the key function in the textual rules pane will be displayed as:
key ("key1" , $VarEmpidSource1) Append the name of the element (Address), of the source2 schema, which needs to be mapped to the target element (Address).
Now the syntax of the mapping will be displayed as:
key ("key1" , $ VarEmpidSource1)/Address (see Figure 545)
Figure 545: Map Key Function Node to Target Element
- Click the Apply Mapping ( ) button. This maps the key to the address element of the target schema. If you shift the focus to another target element, or click any of the Mapping Rules, Textual Rules, Properties, Node, XSL or Debugger tabs, without applying the mapping, then an alert message is displayed (refer to Figure 522).
- Click No to apply the mapping and shift focus to the other object. If you click Yes, then the mapping activity is cleared and is replaced by the previous mapping in the Mapping Graph Area and the focus is shifted to the other object.
- Apply For Each on element address of target schema from Root level of Source2 schema. This will execute key in the context of second source schema (i.e. Source2).
Save the mapping activity and exit the Data Mapper.
Info You can view and validate the generated mapping XSL, view the target XML, and view and validate mapping output, before saving the mapping activity.