#1 2012-06-01 18:50:40

helptransform
Guest

transformation problem

Source table
eno;a_flag;r_flag;c_flag;dept
1;y;y;;10
2;y;n;;10
3;n;n;;10
4;y;y;;20
5;y;y;;20
6;n;y;y20
7;;;30

Output table
dept flag count
10 a_flag 2
10 r_flag 1
10 c_flag 0
20 a_flag 2
20 r_flag 3
20 c_flag 1
30 a_flag 0
30 r_flag 0
30 c_flag 0

how to do this?

#2 2012-06-01 19:48:54

phobucket
Member
Company: Knoetry
Registered: 2010-07-27
Posts: 146
Website

Re: transformation problem

Hi helptransform,

Welcome to the forum

tFileInput --> tUnpivotRow  --> tMap --> tAggregateRow --> t<db>Output


tUnpivotRow is in the Talend Exchange
http://www.talendforge.org/exchange/tos … hp?eid=148

The output of tUnpivotRow will have the flag column.

In the tMap, you will use conditional expressions for the count.
"y".equals(row2.flag)?1:0

In the tAggregateRow, sum the count column, group by the others.

Send the result to a tMySQLOutput (or whatever database you are using)

Good luck.

Thanks,
Ben

Offline

Board footer

Powered by FluxBB