The following example shows the first input file data that you want to use:
CompanyName,Address First National Bank,874 Louis Road Jackson Industry,13 Sydney Drive
The following example shows the second input file data that you want to use:
Name,EmployeeID,Department,Building,Room First National Bank,122,Credit,6,1532 First National Bank,261,Credit,6,2251 First National Bank,431,Credit,6,5312 Jackson Industry,3875,Manufacture,C,673 Jackson Industry,2837,Manufacture,B,211
Create the hierarchical schema in Data Integration with the schema hierarchy that you want to use.
Step 2. Create a mapping
To parse the input data, use a Hierarchy Builder transformation in a mapping to transform the data from the hierarchical input.
In the Mapping Designer, you add two source objects that are flat files that contain the paths to the data files that you want to parse. The following image shows one of the Source transformations:
Step 3. Configure the Hierarchy Builder transformation
You add an Hierarchy Builder transformation and use the name NewHierarchyBuilder. Configure it to use the hierarchical schema that you created.
You connect the source objects to the NewHierarchyBuilder transformation. To map the incoming data to the fields of the transformation, select the NewHierarchyBuilder transformation. In the Incoming Fields tab, ensure that there are no field name conflicts. The following image shows the input field selection:
To map the relational fields to the hierarchical output, in the Field Mapping tab, select primary and foreign keys. Then select which relational fields are linked to schema elements for the hierarchical output.
The following image shows the field mapping selection:
Step 4. Configure the target
Add a file target object for the fields.
The following image shows the final mapping:
Step 5. Run the mapping
Run the mapping to write the data in a hierarchical format to the Target transformation.
The following example shows the hierarchical output: