Count based on date column

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
skumar
Participant
Posts: 88
Joined: Thu May 25, 2006 5:11 am
Location: Hyderabad

Count based on date column

Post by skumar »

Hi All


I have EMPNO,DATE,COUNT columns in my source file and for me the problem is I want to increase my count based on the occurance of the transaction in a particular week for any day.

100 07/09/2009 1
101 07/09/2009 1
102 07/09/2009 1
103 07/09/2009 1

If the existing record comes in any day next week I want the count as below.

100 07/09/2009 1
100 16/09/2009 2
101 07/09/2009 1
102 07/09/2009 1
103 07/09/2009 1

Can some one please throw a light on this?

Thanks in advance.

Regards
Skumar
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

What have you tried so far?

Use sort with change flag.

Pass the result to a transformer with reinitialising a counter on the change flag.
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

Is your source file a static one? Are you loading the details to a destination table?

Can you explain you process and requirement with eg., so that it will be more clear.

Regards,
Divya
srinivas.g
Participant
Posts: 251
Joined: Mon Jun 09, 2008 5:52 am

Post by srinivas.g »

source file---> sort stage(empno) and create clustered key column is true
--->transformer (check emp no and clustered key column is zero i.e c=c+1)--->target file
Srinu Gadipudi
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

What will the clustered key column do? I havn't used that before.

Regards,
Divya
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's documented and the name is closer to Key Change Column rather than cluster anything, from what I recall. It will contain a 1 for the first record in the 'key group' or a 0 otherwise.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply