Wednesday, January 30, 2013

Concat the values based aggregate groups


Suppose the source table has values like this
10 A
10 B
10 C
20 X
20 Y
20 Z
30 D
30 E
30 F

And the target should be

10 A*B*C
20 X*Y*Z
30 D*E*F

How will you do the mapping?

Solution: 

This can be done using an expression transformation and Aggregator transformation.

In expression transformation declare 2 variables ID_V and NAME_V

NAME_V
àIIF(ID_V=ID,NAME_V ‘ * ‘ NAME,NAME)

ID_V
à IIF(ID_V!=ID,ID,ID_V)

NOW pass the output ports to aggregator GROUP BY ID and connect to target.

No comments:

Post a Comment

Thank you :
- kareem