Page 1 of 1

Problem with Aggregator

Posted: Wed Jan 07, 2009 1:54 am
by kksr
Hi All

I am getting a problem while doing the aggregating .

My Input is :
User_ID|Level1|Level2|Level3|Level4
1|A|||
1||B||
1|||C|
1||||D
2|H|||
2||G||
2|||F|
2||||E
My Output Should be :

User_ID|Level1|Level2|Level3|Level4
1|A|B|C|D
2|H|G|F|E

I am using Aggregator , but the actual output is :

User_ID|Level1|Level2|Level3|Level4
1|0|0|0|0
2|0|0|0|0

I have tried with SUM and MAX function aggregator , I am getting the above output .and getting following error .

Implicit conversion from source type "string[max=2]" to result type "dfloat": Converting string to number.

The same logic was working fine in Server by Using FIRST or LAST fucntion in aggregator stage .

Pls suggest how to use First(server ) function in PX to get the expected output.

Thanks In Advance
Kiran

Posted: Wed Jan 07, 2009 3:40 am
by dhanashreepanse
1. What are you setting the Aggregation Type as ?

2. Which column are you setting as the "Column for Calculation?

3. What are the data types for : User_ID|Level1|Level2|Level3|Level4 ?

Posted: Wed Jan 07, 2009 3:55 am
by kksr
I am using the Level1 ,Level2 ,Level3 & Level4 for calculation purpose.And thye data type is Char .

Thanks
Kiran

Posted: Wed Jan 07, 2009 6:07 am
by dhanashreepanse
I think that the Aggregator may not work in this case because of the data type. DS Gurus,correct me if I am wrong.

You can try this approach:
Pass the input file to a transformer and get the output as
1|A
1|B
1|C
1|D
by applying some logic in the transformer.

Then pass it to a Pivot stage to get it in a single row.

Posted: Wed Jan 07, 2009 7:13 am
by vasa_dxx
Aggregator stage is not feasible for Characters but only for Numbers.

Posted: Wed Jan 07, 2009 7:19 am
by Mike
The aggregator defaults to a data type of dfloat. If you want the aggregator to maintain the data type of the input column, you must specify that by setting the "Preserve Type" property to True.

Mike

Posted: Wed Jan 07, 2009 7:20 am
by Mike
You obviously can't do a SUM on character data, but a MAX will work just fine.

Mike