This section describes a mapping situation where some specific node data have to be transformed, while the rest of the node data have to be passed on to the target node unchanged.
An example of this would be a company that changes some of the titles in a subsidiary. In this case it might change two title designations and want to keep the rest as they currently are.
The obvious mapping would be the one shown above, which uses the value-map component to transform the specific titles.
Clicking the Output tab shows us the result of the mapping:
For those persons who are neither of the two types shown in the value-map component, the Title element is deleted in the output file.
Clicking the Otherwise check box and entering a substitute term, does make the Title node reappear in the output file, but it now contains the same New Title for all other persons of the company.
Create a user-defined function containing the value-map component, and use the substitute-missing function to supply the original data for the empty nodes.
|1.||Click the value-map component and select Function | Create user-defined function from Selection.|
|2.||Enter a name for the function e.g. Pass-Through and click OK.|
|3.||Insert a substitute-missing function from the core | node function section of the Libraries pane, and create the connections as shown in the screen shot below.|
|4.||Click the Output tab to see the result:|
Result of the mapping:
|•||The two Title designations in the value-map component are transformed to New Title.|
|•||All other Title nodes of the source file, retain their original Title data in the target file.|
Why is this happening:
The value-map component evaluates the input data.
|•||If the incoming data matches one of the entries in the first column, the data is transformed and passed on to the node parameter of substitute-missing, and then on to Title2.|
|•||If the incoming data does not match any entry in the left column, then nothing is passed on from value-map to the node parameter i.e. this is an empty node.|
When this occurs the substitute-missing function retrieves the original node and data from the Title node, and passes it on through the replace-with parameter, and then on to Title2.
© 2019 Altova GmbH