- Mapping: simple mapping.ktr: (an example of a sub-transformation)
- Mapping: use simple mapping.ktr: (an example of a parent transformation)
Suppose we have a JavaScript step that we want to use multiple
times in several transformations. This sample uses a simple concatenation to demonstrate
mapping.
The two input fields (strings) that the script needs are: leftValue and rightValue. Define these two strings in the Mapping input step:
The calculated value res is a field we want to pass to the parent transformations, so we add a Mapping output step as well.
The resulting mapping looks like the following example:
Now that the mapping is specified, it's ready to be run.
In this example, there are two fields coming into the Mapping step, X=A+B: A and B. A mapping is made between:
- A and leftValue
- B and rightValue
- res and X the result field
This mapping is achieved with the Input and Output tabs of the Mapping dialog box, as shown in these sample screens.
In our sample, we only use one input and output mapping. It is possible however to use 0, 1 or more of either input or output mappings in a mapping transformation. That means that we need to be able to specify which input or output we're addressing in the various tabs. That is where the various step name choices come from in the screenshot.
In this sample, we checked the Main data path option. The corresponding Output tab shows the example's fieldname values in the mapping and target steps.