Abhijit
Abhijit

Reputation: 153

Segregating rows on group count basis-TALEND

I want to implement one famous scenario of Informatica. I have an source file like this:-

EMPNO,EMPNAME,DEPTNO
10,A,1
11,B,2
12,C,3
13,D,4
14,E,1
15,F,1
16,G,2
17,H,3
18,I,4
19,J,2
20,K,3
21,L,1
22,M,2

Now I want to segregate upon occurrence of DEPTNO Column.e.g:

Is any usage of tMemorizerow component here?

I have tried using tmap component but couldn't find the occurence of DEPT NO. Is it possible using tjavaflex component writing a java code? I am able to segregate to inputflow into 4 parts inside first tmap after tfileinputdelimited. Then I am taking 4 taggregaterow.

Upvotes: 1

Views: 588

Answers (2)

Théo Capdet
Théo Capdet

Reputation: 1062

You can use a taggregaterow With this component you can do the equivalent of a GROUP BY in SQL. More over you can do an operation with the group by. You use the count function inside

In order to filter DEPTNO you need a filter in tmap

Example : enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Moreover there are some information about the taggregaterow component : Here

Upvotes: 1

Corentin
Corentin

Reputation: 2552

You could use a tAggregateRow and a tFilterRow in order to aggregate your source file by DEPTNO, and then filter to get a flow with only DEPNTO with nb of occurences > 3. Then you read again the source file, and join the flows with a tMap (inner join).

A draft of components to use :

A draft of components to use

you could also simplify the job with tHash components in order to read the source only once.

Upvotes: 0

Related Questions