In Informatica development, we can use the normalizer component to convert the data format. First, we will introduce some property parameters of the normalizer component.
Attribute |
Description |
Column name |
Name of the source column. |
Level |
Group Columns. columns in the same group occur beneath a column with a lower level number. When each column is the same level, the transformation contains no column groups. |
Occurs |
The number of instances of a column or group of columns in the source row. |
Datatype |
The transformation column datatype can be string, nstring, or number. |
Prec |
Precision. Length of the column. |
Scale |
Number of decimal positions for a numeric column. |
Instance 1
Source data
Name ~ Score1 ~ Score2
Jim ~ 80 ~ 70
Conversion Result
Name ~ Score
Jim ~ 80
Jim ~ 70
To achieve the preceding conversion, we only need to create a normalizer and create two fields under the normalier tab.
Name: 0 (level), 0 (occurs)
Score: 0 (level), 2 (occurs) -- meaning two columns need to be transposed
After the creation is complete, normalizer automatically generates the corresponding columns according to the preceding settings.
Name_in, score_in1, score_in2 are connected to the corresponding source table column (name, score1, score2.
Name and score will store the converted data.
Gk_id generates an ID for the converted data.
The column ID where gcid_score stores data. If the score is 80 and gcid_score is 2, it indicates the second column of data in the source table.
Instance 2
Source data
Name ~ Course1 ~ Score1 ~ Course2 ~ Score2
Jim ~ Chinese ~ 80 ~ English ~ 70
Conversion Result
Name ~ Course ~ Score
Jim ~ Chinese ~ 80
Jim ~ English ~ 70
The data here has a hierarchical relationship, and our design needs to be slightly different.
Create 3 fields, name, course, and score
Click course, and then click "" to generate a field named "name". Similarly, click "" on the score. In this way, a hierarchical relationship between columns is obtained based on level.
Set course and score occurs to 2. After completion, obtain the normalizer component, as shown in.
Finally, connect the columns of related components.