Is there count without using aggregator
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 13
- Joined: Wed Feb 06, 2008 3:55 am
Is there count without using aggregator
Hi,
IS there any way in datastage to count group by columns..suppose for example one project manager have 4 projects and the other have two projects.then we like to have the count of projects of each project manager projects.let name of project manager is one column and list of projects is another columns.without using aggregator
IS there any way in datastage to count group by columns..suppose for example one project manager have 4 projects and the other have two projects.then we like to have the count of projects of each project manager projects.let name of project manager is one column and list of projects is another columns.without using aggregator
Re: Is there count without using aggregator
using stage variable will help.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Welcome aboard.
The answer is yes, but why would you want to? That's what the Aggregator stage is for.
And it works MUCH, MUCH BETTER if the data are sorted on the grouping key(s) and you assert this fact on the input link to the Aggregator.
The Transformer stage method REQUIRES sorted input to be sensible about identifying change of group.
The answer is yes, but why would you want to? That's what the Aggregator stage is for.
And it works MUCH, MUCH BETTER if the data are sorted on the grouping key(s) and you assert this fact on the input link to the Aggregator.
The Transformer stage method REQUIRES sorted input to be sensible about identifying change of group.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 13
- Joined: Wed Feb 06, 2008 3:55 am
Re: Is there count without using aggregator
rrsivaraghava wrote:Hi,
IS there any way in datastage to count group by columns..suppose for example one project manager have 4 projects and the other have two projects.then we like to have the count of projects of each project manager projects.let name of project manager is one column and list of projects is another columns.without using aggregator
how to do by using stage variable.how to count the group by columns
Re: Is there count without using aggregator
check with the post below
Can we do sum in transformer stage?If yes how?
see the answer from baglasumit21
Can we do sum in transformer stage?If yes how?
see the answer from baglasumit21
define a stage variable stgcount as initial value 1, stgvar1 with initial value '' use the following derivation in stage variableHi,
IS there any way in datastage to count group by columns..suppose for example one project manager have 4 projects and the other have two projects.then we like to have the count of projects of each project manager projects.let name of project manager is one column and list of projects is another columns.without using aggregator
In the column derivation just use the stgvar1stgcount -> if projectmanager = stgvar1 then stgcount +1 else 1
stgvar1 -> projectmanager
after transformaer use the remove duplicate stage, projectmanager as the key, keeping the last record
hence the job design would be
input----->Transformer--->remove duplicate---->output
Birendra
-
- Participant
- Posts: 13
- Joined: Wed Feb 06, 2008 3:55 am
just try to implement the approach i have suggested. suppose your record look like as follow
Project manager Name of projest
------------------------------------------------
1 X
2 X
1 Y
1 Z
2 Y
then the job will give
Project manager No of project
---------------------------------------------
1 1
1 2
1 3
2 1
2 2
Now the remove duplicate stage will remove the records keeping the last.
Project manager No of project
---------------------------------------------
1 3
2 2
Hope i understand you problem and this make sense...
Note... Records should be sorted on " project manager" before using the approach.
Thanks,
Birendra
Project manager Name of projest
------------------------------------------------
1 X
2 X
1 Y
1 Z
2 Y
then the job will give
Project manager No of project
---------------------------------------------
1 1
1 2
1 3
2 1
2 2
Now the remove duplicate stage will remove the records keeping the last.
Project manager No of project
---------------------------------------------
1 3
2 2
Hope i understand you problem and this make sense...
Note... Records should be sorted on " project manager" before using the approach.
Thanks,
Birendra
Birendra
-
- Participant
- Posts: 13
- Joined: Wed Feb 06, 2008 3:55 am
-
- Participant
- Posts: 13
- Joined: Wed Feb 06, 2008 3:55 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
U hasn't logged in to DSXchange for a couple of months. I assume that plz is a town in the Balkans somewhere.rrsivaraghava wrote:can u plz tell the detail stage variable for this
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 13
- Joined: Wed Feb 06, 2008 3:55 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 13
- Joined: Wed Feb 06, 2008 3:55 am