Page 1 of 1

Sequence on the output from an aggregator stage

Posted: Wed Apr 27, 2011 3:05 pm
by saraswati
I want to do sum on the values of a column and then populate it into another column.Then, use remove duplicate to remove the duplicate records so that there will be only one records with summed value based on the key columns.

Now,I want to set a sequence or rather a value '1' into another column based on the highest value on a key column.

For Example:
1000 4 1 --------> As 4 is the highest
1000 2 2 ---------> As 2 is the next highest.
1000 1 3 ---------> As 1 is the next highest.
..............

1 , 2 ,3 should be in sequence based on the highest values on the second column.

Please let me know how to implement it.

Posted: Wed Apr 27, 2011 3:14 pm
by ray.wurlod
Use a fork-join design with an Aggregator reporting the max value. Downstream check whether the max value is the same as the current value and set your flag accordingly.

Re: Sequence on the output from an aggregator stage

Posted: Thu Apr 28, 2011 3:20 am
by srinivas.nettalam
Use the first and second columns in sort as sorting keys in descending order and generate the sequence numbers until the value in the key col1(1000) is changed.That can be achieved using stage variables in the transformer

Posted: Thu Apr 28, 2011 4:36 am
by zulfi123786
So far as i understand you are consecutively summing up values of a column and want to flag them so that you can use the flag in remove duplicates stage to identify the record which has got the actual sum for all records bearing the same key.

Well you can do that as suggested or what i feel is you may not need to flag them at all. you could perform a consecutive sum and then pass on the records to remove duplicates stage and sort it on the summed column as desc and fetch the first row, by doing so you would be selecting the correct record which has the actual sum of all rows for that column