Page 1 of 1

Row count with transformer.

Posted: Wed Aug 03, 2011 8:20 am
by kennyapril
I have a field customerInfoID which has duplicates like 101,101,101,101,102,102,102.
The output I need is 101,4 and 102,3 i.e row count of each customerInfoID.

This can be done through aggregator but I wanted to do this in transformer to avoid using aggregator

please suggest me the function which has to be used



Thanks

Posted: Wed Aug 03, 2011 8:41 am
by vinothkumar
I think there are no specific functions to do this in transformer. You have to use StageVariables along with transformer.

Posted: Wed Aug 03, 2011 9:12 am
by kennyapril
In the stage variable do I need to find the count of Rows or how can I do it?


Thanks

Posted: Wed Aug 03, 2011 9:55 am
by chulett
It's basic 'group change detection'. You increment a stage variable each time you see the same 'group'. For a new group, you set the count back to 1.

Leveraging the Sort stage with a 'Key Change Column' will simplify this for you.

Posted: Wed Aug 03, 2011 12:33 pm
by vinothkumar
Use remove duplicates stage and keep the last one.

Posted: Wed Aug 03, 2011 4:00 pm
by kennyapril
That works!!

Thankyou All