Design a mapping to convert column data into row data without using the
normalizer transformation.
The source data looks like
col1, col2,
col3
a, b, c
d, e, f
The target table data should look
like
Col
a
b
c
d
e
f
Create
three expression transformations with one port each. Connect col1 from Source
Qualifier to port in first expression transformation. Connect col2 from Source
Qualifier to port in second expression transformation. Connect col3 from source
qualifier to port in third expression transformation. Create a union
transformation with three input groups and each input group should have one
port. Now connect the expression transformations to the input groups and connect
the union transformation to the target table.
Design a mapping to convert row data into column data.
The source data looks
like
id, value
10, a
10, b
10, c
20, d
20, e
20,
f
The target table data should look like
id, col1, col2,
col3
10, a, b, c
20, d, e,
f
Step1: Use sorter
transformation and sort the data using id port as the key. Then connect the
sorter transformation to the expression
transformation.
Step2: In the expression transformation,
create the ports and assign the expressions as mentioned
below.
id
value
V_curr_id=id
V_count=
IIF(v_curr_id=V_prev_id,V_count+1,1)
V_prev_id=id
O_col1=
IIF(V_count=1,value,NULL)
O_col2= IIF(V_count=2,value,NULL)
O_col3=
IIF(V_count=3,value,NULL)
Step3: Connect the expression
transformation to aggregator transformation. In the aggregator transforamtion,
create the ports and assign the expressions as mentioned below.
id
(specify group by on this
port)
O_col1
O_col2
O_col3
col1=MAX(O_col1)
col2=MAX(O_col2)
col3=MAX(O_col3)
Stpe4:
Now connect the ports id, col1, col2, col3 from aggregator transformation to the
target table.
Click below links for more Informatica Interview Questions and Answers
Informatica Interview 1
Informatica Interview 2
Informatica Interview 3
No comments:
Post a Comment