Just i want to know how to combine identical rows(date)in a column
sample data
date ro_code desc mv sv uv C
01/10/2006 12 REGION 0 1 0 0
02/10/2006 12 REGION 0 1 0 0
03/10/2006 12 REGION 0 1 1 0
01/10/2006 12 REGION 0 0 1 0
02/10/2006 12 REGION 0 0 1 0
CAN ANYONE PLZ HELP ME HOW TO COMBINE IDENTICAL ROWS LIKE ROW1 AND ROW 3 HAVING SAME DATE, ROCODE AND DESC. AND ROW2 AND
ROW 4
AS WELL..
THANK U
Combinine two or more identical rows
Moderators: chulett, rschirm, roy
Combinine two or more identical rows
prabakaran.v
The rows aren't identical, some of the columns are. You haven't described what the combined row is to look like or what the combination rules are.
This type of thing is commonly done in DataStage.
This type of thing is commonly done in DataStage.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
So your rule is "if the date and the ro_code are the same, then do a logical "OR" on the column values"? Is that correct?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
Use stage variables in transformer and adopt remove duplicate strategy to merge fields. Explore Sort stage with keychange as well.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
-
- Participant
- Posts: 78
- Joined: Fri Mar 02, 2007 4:54 am
- Location: CHENNAI
As Arndw said you can do it by using logical "or" operator.
Take your ouput as hash file and use the same hash file for reference in the same job.
Then take 4 stage variables for Date and Row_cd.
E.g:
Pre_Date->HshFile.Date,Curr_Date->SeqFile.Date lly for row_cd.
Then take one temp stage variable and write the logic in it as:
"If (Pre_Date <> Curr_Date ) Or (Pre_RowCd <> Curr_RowCd) Then
"N"
Else
(Seq.mv Or DSLink6.mv):(Seq.sv Or DSLink6.sv):(Seq.uv Or Hsh.uv):(Seq.C Or Hsh.C)"
Then in your hash file write as
OuputHshFile.mv->"If Varmv <> "N" Then Varmv[1,1] Else DSLink4.mv"
Similarly for others
Take your ouput as hash file and use the same hash file for reference in the same job.
Then take 4 stage variables for Date and Row_cd.
E.g:
Pre_Date->HshFile.Date,Curr_Date->SeqFile.Date lly for row_cd.
Then take one temp stage variable and write the logic in it as:
"If (Pre_Date <> Curr_Date ) Or (Pre_RowCd <> Curr_RowCd) Then
"N"
Else
(Seq.mv Or DSLink6.mv):(Seq.sv Or DSLink6.sv):(Seq.uv Or Hsh.uv):(Seq.C Or Hsh.C)"
Then in your hash file write as
OuputHshFile.mv->"If Varmv <> "N" Then Varmv[1,1] Else DSLink4.mv"
Similarly for others