I Tried Using Hierarchy Parser and Hierarchy Builder Transformations In Informatica.

I Tried Using Hierarchy Parser and Hierarchy Builder Transformations In Informatica.

Clock Icon2024.08.22

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 .
    h-1
  • In the Name field, enter Hierarchical Schema2.
    h-2
  • To upload the Schema/Sample, Click Upload and choose the file emp.xsd from your device.
    h-3
  • In the Schema Root, keep root and save the schema.
    h-4
  • Hierarchical Schema has been created successfully.

Create Mapping

  • Create a new Mapping with the name m_02_HR_Employees.
    h-m-1
  • 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.
        h-m-2

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.
        hr-1
    • Input Settings:

      • To select the schema, click Select and select Hierarchical Schema2 which has been created earlier.
      • For Input Type, keep File.
        hr-2
      • Link Src to HierarchyParser.
        hr-3
    • Input Field Selection:

      • To map the Incoming field with the Hierarchical Schema Input field, drag and drop the Path onto the Input field.

      hr-4

    • 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.
        hr-4
        hr-5
    • Output Fields:

      • Verify that all the 11 fields are present.
        hr-6
  • 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.

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.
        hb2
    • Field Mapping:
      • From the Schema Structure section, click plus icon.
      • Map the fields as shown in the image below.
        hb3

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.
          hb4
        • Click Formatting Options.
        • For the Delimiter field, select other, and enter a period (.).
          hb5
      • Expand the Advanced section in Target.
        • Set Header Options to No Header and choose Comma from the Decimal Separator drop-down menu.
          hb6
    • Finally, Save and Run the mapping.

Results

  • Click My Jobs and check the execution status of the mapping. When the task completes, the status changes to Success.
    test-1
  • Verify the data in target file of Hierarchy Parser S_02_Formatted_EmpData.csv.
    S_02_Formatted_EmpData.csv
  • Verify the data in target file of Hierarchy Builder S_02_Hierarchy_Builder.xml.
    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.

この記事をシェアする

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.