Convert Relational or Hierarchical Data to Struct Data
You can convert relational or hierarchical data in one or more columns to hierarchical data of type struct. Use the Create Struct Port wizard in the Developer tool to perform the conversion.
For example, a relational table contains three columns city, state, and zip. You create a mapping to convert the data in the three columns to one hierarchical column. Select the three ports in the transformation and use the Create Struct Port wizard to generate struct data with the selected ports as its elements.
The wizard performs the following tasks:
- •Creates a complex data type definition based on the ports that you select.
- •Adds an Expression transformation to the mapping.
- •Creates a struct output port to represent the struct data.
- •Creates an expression that uses the STRUCT_AS function to generate struct data.
Creating a Struct Port
Use the Create Struct Port wizard to convert data that passes through one or more ports to struct data.
1. In the transformation, select one or more ports that you want to convert as elements of the struct data.
The ports you select also determine the elements of the complex data type definition.
2. Right-click the selected ports, and select Hierarchical Conversions > Create Struct Port.
The Create Struct Port wizard appears with the list of ports that you selected.
3. Optionally, in the Name box, change the name of the complex data type definition.
For example, typedef_address.
4. Optionally, click Choose to select other ports in the transformation.
5. Click Finish.
You can see the following changes in the mapping:
- •The mapping contains a new Expression transformation Create_Struct with a struct output port and a dynamic port with ports from the upstream transformation.
- •The type definition library contains the new complex data type definition.
- •The struct output port references the complex data type definition.
- •The struct output port contains an expression with the STRUCT_AS function. For example,
STRUCT_AS(:Type.Type_Definition_Library.typedef_address,city,state,zip)