Highlighted
One Star

## operation with tmap or taggregate, calculation

Hi
could anybody help?
I have a file like this:
ID F. No.1 No.2 No.3
A 3 1 1
B 2 1 1
C 4 1 1 1
A 3 1 1
A 2 1 1

in the end I want to have this: Rows which have the same ID and F. should go together
ID F. No.1 No.2 No.3
A 3 1 1 1
B 2 1 1
C 4 1 1 1
A 2 1 1
Could this be solved with t-map or taggreaterow ?
Highlighted
Employee

## Re: operation with tmap or taggregate, calculation

In the aggregation, which operation do you want to perform? because for ID-A, f-3, No.2 should be 2 if you sum. So, do you want a "exists" function ?
Highlighted
Community Manager

## Re: operation with tmap or taggregate, calculation

Hello Ham
Does the value of 'No1..NO3' always be empty or '1'? if so ,you can use the max function, here is a scenario:
input file:
a;3;1;1;
b;2;;1;1
c;4;1;1;1
a;3;;1;1
a;2;;1;1
result;
`Starting job forum5928 at 21:57 23/03/2009.ID: c|F: 4|NO1: 1|NO2: 1|NO3: 1ID: a|F: 3|NO1: 1|NO2: 1|NO3: 1ID: a|F: 2|NO1: |NO2: 1|NO3: 1ID: b|F: 2|NO1: |NO2: 1|NO3: 1Job forum5928 ended at 21:57 23/03/2009. `

Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
One Star

## Re: operation with tmap or taggregate, calculation

An existing-function sounds good.
I tried with taggregate. But the result is false. It counts the number of equal IDs, but not the number of No.1, No.2.... for each ID with it F.
Could you explain taggregate to me?
Highlighted
Employee

## Re: operation with tmap or taggregate, calculation

 An existing-function sounds good.

 Could you explain taggregate to me?

For a description of tAggregateRow, please check the documentation user guide.
Here comes an example of to perform your job, without the "exists" aggregation function, the trick is to perform a sum, and then reduce to undef or 0. The output of my job is:
`Starting job topic5928 at 15:03 24/03/2009..--------------------------.|         tLogRow_1        |+----+---+-----+-----+-----+| id | f | no1 | no2 | no3 |+----+---+-----+-----+-----+| A  | 3 |   1 |   1 |   1 || A  | 2 |     |   1 |   1 || C  | 4 |   1 |   1 |   1 || B  | 2 |     |   1 |   1 |'----+---+-----+-----+-----'===execution time: 15 milliseconds===Job topic5928 ended at 15:03 24/03/2009. `

## OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

## Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

## Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

## Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog