I Tried Using Hierarchy Parser and Hierarchy Builder Transformations In Informatica.
Introduction
I'm Shiwani from the Data Analytics Division.
This time, i am creating a mapping using hierarchy parser and hierarchy builder transformation. The Hierarchy Parser transformation converts hierarchical input into a relational output. The Hierarchy Builder transformation converts input data into a hierarchical output using a schema file.
Objective:
- Create a hierarchical schema
- Use Hierarchy Parser transformation
- Use Hierarchy Builder transformation
Prerequisite
- The IICS Secure Agent and VPC have been configured.
- Click emp.xsd and download the sample file.
- Click Source.xml and download the sample file.
- Create a .txt file with the name Src.txt and the path of the Source.xml file as shown in the example below:
Path \home\IICSLabFiles\SrcFiles\Source.xml
- Create a connecter to establish connection with the source file.
- Create a connecter to establish connection with the Target file.
Create Hierarchical Schema
- Login to IICS and Select the Data Integration service.
- In the New Asset window, go to the Components tab. Choose Hierarchical Schema and Click Create .
- In the Name field, enter Hierarchical Schema2.
- To upload the Schema/Sample, Click Upload and choose the file emp.xsd from your device.
- In the Schema Root, keep root and save the schema.
- Hierarchical Schema has been created successfully.
Create Mapping
- Create a new Mapping with the name m_02_HR_Employees.
- Click the Source transformation and enter the following properties details.
- General:
- Enter the Name as Src.
- Source:
- From the Connection drop-down, select your source file connection.
- Object :
- Click Select and select the file Src.txt.
- Click Select and select the file Src.txt.
- General:
Add a Hierarchy Parser Transformation
- Add Hierarchy Parser between the Src and Target transformations.
- Click Hierarchy Parser transformation and enter the following properties details.
-
General:
- Enter the Name as HierarchyParser.
- Enter the Name as HierarchyParser.
-
Input Settings:
- To select the schema, click Select and select Hierarchical Schema2 which has been created earlier.
- For Input Type, keep File.
- Link Src to HierarchyParser.
-
Input Field Selection:
- To map the Incoming field with the Hierarchical Schema Input field, drag and drop the Path onto the Input field.
-
Field Mapping:
- From the Schema Structure section, click plus icon.
- From the Element Name lists, select Employeeid, Firstname, and Lastname.
- From the address drop-down, select Map immediate children.
-
Output Fields:
- Verify that all the 11 fields are present.
- Verify that all the 11 fields are present.
-
- Link HierarchyParser with Target.
- Select Emp_Details and click OK.
Add Target Transformation
- Click the Target transformation and enter the following properties details.
- General:
- Enter the name Tgt_HierarchyParser.
- Target:
- Select your Target Flat File Connection.
- Object:
- Select Create New at Runtime. Enter S_02_Formatted_EmpData.csv as Static File Name.
- General:
Add a Hierarchy Builder Transformation
- Add the Hierarchy Builder transformation in mapping and enter the following details.
- Output Settings:
- To select the Schema, click Select and select Hierarchical Schema2 which has been created earlier.
- Link Hierarchy Parser transformations with Hierarchy Builder transformation.
- Select Emp_Details and click OK.
- Field Mapping:
- From the Schema Structure section, click plus icon.
- Map the fields as shown in the image below.
- Output Settings:
Add Target Transformation
- Click the Target transformation and enter the following properties details.
- General:
- Enter the name Tgt_HierarchyBuilder.
- Target:
- Select your Target Flat File Connection.
- Object:
- Select Create New at Runtime. Enter S_02_Hierarchy_Builder.xml as Static File Name.
- Click Formatting Options.
- For the Delimiter field, select other, and enter a period (.).
- Select Create New at Runtime. Enter S_02_Hierarchy_Builder.xml as Static File Name.
- Expand the Advanced section in Target.
- Set Header Options to No Header and choose Comma from the Decimal Separator drop-down menu.
- Set Header Options to No Header and choose Comma from the Decimal Separator drop-down menu.
- Finally, Save and Run the mapping.
- General:
Results
- Click My Jobs and check the execution status of the mapping. When the task completes, the status changes to Success.
- Verify the data in target file of Hierarchy Parser S_02_Formatted_EmpData.csv.
- Verify the data in target file of Hierarchy Builder S_02_Hierarchy_Builder.xml.
- Here, i have successfully used hierarchy parser and hierarchy builder transformation in mapping. As Results shows that target files (S_02_Formatted_EmpData.csv, S_02_Hierarchy_Builder.xml) produced the expected output.