Hierarchical to Relational Transformation Development
Use the New Transformation wizard to auto-generate a Hierarchical to Relational transformation. Choose a schema or hierarchical sample file to define the input hierarchy.
- 1. Create the transformation in the Developer tool.
- 2. Configure the input port and mapping.
- 3. Test the transformation.
Creating the Hierarchical to Relational Transformation
1. In the Developer tool, click File > New > Transformation.
2. Select the Hierarchical to Relational transformation and click Next.
3. Enter a name for the transformation and browse for a Model repository location to put the transformation and click Next.
4. To select a schema, select one of the following methods:
- - To use a schema from the Model repository to define the input hierarchy, near the Schema Object field, browse to select the schema file from the repository.
- - To import a schema file, click Create a new schema object. In the New schema object window, you can browse to and select a schema file, or you can select to create a schema from a sample hierarchical file.
5. Choose the root for the output hierarchy. In the Hierarchy root dialog box, select the element in the schema that is the root element for the output hierarchical file. To help select the root object, you can add a sample hierarchical file. To add a sample file, near the Sample File field, browse for and select the file from the file system.
6. Click Finish.
The wizard creates the transformation in the repository.
Configuring the Ports and Mapping
Configure the input and output ports in the Overview view.
1. Select the input port datatype, port type, precision and scale.
2. To view the mapping, in the Overview view Ports area, select Output Mapping.
3. Expand the trees in the Ports grid. To the left, the Transformation input panel shows the expected hierarchical input, and to the right, the Transformation output panel shows the relational output.
4. To define a node as a root, click Choose Hierarchy.
The Developer tool displays only the nodes from the root level and below the root level in the Transformation input area.
5. To view lines that connect the ports with the hierarchical nodes, click Show Lines. Select to view all the connection lines or just the lines for selected ports.
6. To add an input group or port to the Transformation output area, use one of the following methods:
- - Drag a simple or complex element in the Transformation input area to an empty column in the Transformation output area. If the node is a group node, the Developer tool adds a relational group without ports.
- - To add a relational group, select a row and right-click to select New > Group.
- - To add a relational port, right-click to select New > Field.
7. To clear the hierarchical node settings for locations of ports, use one of the following methods:
- - Select one or more nodes in the Transformation input area, right-click and select Clear.
- - Select one or more lines that connect the relational ports to the hierarchical nodes, right-click and select Delete.
8. To display the output ports in a hierarchy, click Show As Hierarchy. Each child group appears underneath the parent group.
Testing the Transformation
Test the Hierarchical to Relational transformation in the Data Viewer view.
Before you test the transformation, verify that you defined the file input location. You define the input location on the DIS machine in the Input Location column of the Ports panel in the Overview view.
1. Open the Data Viewer view.
2. Click Run.
The Developer tool validates the transformation. If there is no error, the Developer tool shows the hierarchical file content in the Output panel.