Transformations > Hierarchy Processor transformation > Data processing strategies
  

Data processing strategies

The Hierarchy Processor transformation is an active transformation that you can use to process data from complex data sources in an elastic mapping. The transformation can read relational or hierarchical input and convert it to relational or hierarchical output.
The default output data format is relational.

Hierarchical to relational data processing

In a mapping that converts hierarchical data to relational output, you can flatten one hierarchical data source and write the data to multiple target output files. The flattened output data can be written to relational data stores or delimited flat files.
The following image shows the mapping:
The mapping contains a Source transformation that is connected to a Hierarchy Processor transformation that is connected to two Target transformations.
In this mapping, the data source is a complex file containing customer and order data. The data flows into two relational files: a file with customer data and a file with order data.

Relational to hierarchical data processing

In a mapping that converts relational data to hierarchical output, you can have up to five relational data sources and write to one hierarchical target output file. This transformation allows you to create structs and arrays. It also allows you to join data sources, group by and order by data fields, filter for specific information, and aggregate both the input and output data.
The following image shows the mapping:
The mapping contains three Source transformations that are connected to a Hierarchy Processor transformation that is connected to one Target transformation.
In this mapping, the source input includes three relational files: customer address data, purchase orders, and purchase order details. The data flows into one complex file that combines data from the three source files.

Hierarchical to hierarchical data processing

In a mapping that converts hierarchical data to hierarchical data, you can read from one or more hierarchical data sources and write to one hierarchical data file.
You can convert hierarchical input from one schema to a different schema. You can read data from primitive fields, structs, and arrays and arrange the data in a different structure.
You can also transform the data that you are converting. You can join data sources, configure group by and order by fields, filter for specific information, and aggregate incoming and output data.
The following image shows an example of an elastic mapping that uses a Hierarchy Processor transformation to convert hierarchical data to hierarchical data of a different structure:
The mapping shows a source connected to a Hierarchy Processor transformation connected to a target. The Hierarchy Processor transformation is selected in the Mapping Designer, and the Hierarchy Processor tab is selected. The Incoming Fields panel shows one input group with the following fields: CompanyName (string) and Orders (array). The Orders array contains the OrderPrice, OrderDate, Street, City, State, Country, and ZipCode fields. The Output Fields panel contains one output group with the following fields: Company Name (string), Orders (array), and TotalOrderPrice (double). The Orders array contains the following fields: OrderPrice (double), OrderDate (string), Items (array), and OrderAddress (struct).
In this mapping, the data source is a JSON file that contains orders and items data. The data flows into a different JSON file that contains order information. The Hierarchy Processor transformation is selected, and the Hierarchy Processor tab shows the structure of the incoming and output data.