how i can achieve this result in datastage 7.5 px
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 37
- Joined: Tue Nov 30, 2010 10:51 am
how i can achieve this result in datastage 7.5 px
input lookup table
partno d_eff_date cost
1 10-Jan-12 10
1 10-Mar-12 12
1 10-Jun-12 15
1 15-Jul-12 20
input dataset
partno bulid date
1 10-Jan-12
1 11-Jan-12
1 11-Mar-12
output
partno bulid date d_eff_date cost shouldbe
1 10-Jan-12 10-Jan-12 10
1 11-Jan-12 10-Jan-12 10
1 11-Mar-12 10-Mar-12 12
partno d_eff_date cost
1 10-Jan-12 10
1 10-Mar-12 12
1 10-Jun-12 15
1 15-Jul-12 20
input dataset
partno bulid date
1 10-Jan-12
1 11-Jan-12
1 11-Mar-12
output
partno bulid date d_eff_date cost shouldbe
1 10-Jan-12 10-Jan-12 10
1 11-Jan-12 10-Jan-12 10
1 11-Mar-12 10-Mar-12 12
I'm intrigued... how?nani1974 wrote:I think you can do this by using Column_Export stage.
As for requirement, create a date range out of your lookup.
Or depending on data sizes and db abilities, do a sparse lookup getting rows with date <= current date (as per row) order by date desc and limit to 1
-
- Participant
- Posts: 37
- Joined: Tue Nov 30, 2010 10:51 am
-
- Participant
- Posts: 37
- Joined: Tue Nov 30, 2010 10:51 am
-
- Participant
- Posts: 37
- Joined: Tue Nov 30, 2010 10:51 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Upgrade to the current version and use a range lookup.
Otherwise do a sparse lookup as indicated, looking for the largest date smaller than your lookup date for that particular key value.
Otherwise do a sparse lookup as indicated, looking for the largest date smaller than your lookup date for that particular key value.
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.
Hi Informdaya
Hi Informdaya,
I have tried the above scenario by taking two transformer, one after the source and another after the reference.In both the transformer stage I have used following steps-
1. Stage variables-
StgVar1=Seq(Field(InputColumn,"-",2,1)[1,1])
StgVar2=Seq(Field(InputColumn,"-",2,1)[2,1])
StgVar3=Seq(Field(InputColumn,"-",2,1)[3,1])
2. Added one extra column Lookup (Int).Derivation for which is as below-
StgVar1:StgVar2:StgVar3
3. Now in lookup stage lookup between the Lookup column of the Source and the reference.
OR
1.In transformer, in the derivation for the Lookup column-
MonthFromDate(StringToDate(InputColumn,"%yyyy-%mm-%dd")).
2.Now in lookup stage lookup between the Lookup column of the Source and the Reference.
In both the above cases I have done lookup operation on Month. It gave me the desired result.
Please correct me if understanding is not correct.
I have tried the above scenario by taking two transformer, one after the source and another after the reference.In both the transformer stage I have used following steps-
1. Stage variables-
StgVar1=Seq(Field(InputColumn,"-",2,1)[1,1])
StgVar2=Seq(Field(InputColumn,"-",2,1)[2,1])
StgVar3=Seq(Field(InputColumn,"-",2,1)[3,1])
2. Added one extra column Lookup (Int).Derivation for which is as below-
StgVar1:StgVar2:StgVar3
3. Now in lookup stage lookup between the Lookup column of the Source and the reference.
OR
1.In transformer, in the derivation for the Lookup column-
MonthFromDate(StringToDate(InputColumn,"%yyyy-%mm-%dd")).
2.Now in lookup stage lookup between the Lookup column of the Source and the Reference.
In both the above cases I have done lookup operation on Month. It gave me the desired result.
Please correct me if understanding is not correct.
-
- Participant
- Posts: 37
- Joined: Tue Nov 30, 2010 10:51 am
Re: Hi Informdaya
Can you pls more explain on the process. for first table (ref table) look up key is (partno and d_effectv ). From main table it will be part_no and build_date should be equal to min of d_effectv. You told this is applicable for month only. Actully this ref table is duty rate table and might change that for few month or may be in a year. My main source hold 15 milion records and ref table conatin 10 min records.
Hi Informdaya
In that case, as Ray suggested it is possible through range lookup available in the latest version.