Hi folks,
I have a slight problem.
The below code is for the ActiveXScript which is used for the Data Transformation:
Code:
Function Main()
dim arrname
DTSDestination("IHEDAT")=DTSSource("EDDT")
'DTSDestination("ADDIMS")=DTSSource("HLFL")
DTSDestination("IHRELG")=DTSSource("RELG")
arrname = DTSLookups("lk_epg_eve").Execute(DTSSource("PKEY"),DTSSource("ADDT"))
If IsEmpty(arrname) Then
'MsgBox(DTSSource("PKEY"))
'MsgBox(DTSSource("ADDT"))
arrname = DTSLookups("lk_MAT_AD").Execute(DTSSource("PKEY"),DTSSource("ADDT"))
If IsEmpty(arrname) Then
Else
DTSDestination("IHMROL") = arrname(0)
DTSDestination("IHROLL") = arrname(1)
DTSDestination("IHADAT") = arrname(2)
DTSDestination("IHATIM") = arrname(3)
DTSDestination("IHAFLG") = arrname(4)
DTSDestination("IHCCON") = arrname(5)
DTSDestination("IHCSPC") = arrname(6)
DTSDestination("IHWLKY") = arrname(7)
DTSDestination("IHTDAT") = arrname(8)
DTSDestination("IHTTIM") = arrname(9)
DTSDestination("IHPMAN") = arrname(10)
DTSDestination("IHSORC") = arrname(11)
DTSDestination("IHMETH") = arrname(12)
DTSDestination("IHDMET") = arrname(13)
DTSDestination("IHDDST") = arrname(14)
DTSDestination("IHDDAT") = arrname(15)
DTSDestination("IHDTIM") = arrname(16)
DTSDestination("IHACAT") = arrname(17)
DTSDestination("IHWARD") = arrname(18)
DTSDestination("ADDIMS") = arrname(19)
End If
Else
'MsgBox(DTSSource("PKEY"))
DTSDestination("IHMROL") = arrname(0)
DTSDestination("IHROLL") = arrname(1)
DTSDestination("IHADAT") = arrname(2)
DTSDestination("IHATIM") = arrname(3)
DTSDestination("IHAFLG") = arrname(4)
DTSDestination("IHCCON") = arrname(5)
DTSDestination("IHCSPC") = arrname(6)
DTSDestination("IHWLKY") = arrname(7)
DTSDestination("IHTDAT") = arrname(8)
DTSDestination("IHTTIM") = arrname(9)
DTSDestination("IHPMAN") = arrname(10)
DTSDestination("IHSORC") = arrname(11)
DTSDestination("IHMETH") = arrname(12)
DTSDestination("IHDMET") = arrname(13)
DTSDestination("IHDDST") = arrname(14)
DTSDestination("IHDDAT") = arrname(15)
DTSDestination("IHDTIM") = arrname(16)
DTSDestination("IHACAT") = arrname(17)
DTSDestination("IHWARD") = arrname(18)
DTSDestination("ADDIMS") = arrname(19)
End If
Main = DTSTransformStat_OK
End Function
This code is for the lk_epg_eve lookup
Code:
SELECT HSPPROG.EPG.PKEY, HSPPROG.EPG.EPSD, HSPPROG.EPG.ADDT, HSPPROG.EPG.ADTM, HSPPROG.EVE.EVT, HSPPROG.EPG.CONS,
HSPPROG.EPG.SPCD, HSPPROG.EPG.WKEY, HSPPROG.EVE."DATE", HSPPROG.EVE."TIME", HSPPROG.EPG.INTN, HSPPROG.EPG.ADSC,
HSPPROG.EPG.ADMT, HSPPROG.EPG.DSMT, HSPPROG.EPG.DSDS, HSPPROG.EPG.EPEN, HSPPROG.EPG.EETM, HSPPROG.EPG.STAT,
HSPPROG.EVE.TWHE, HSPPROG.EVE.CHR1
FROM HSPPROG.EPG, HSPPROG.EVE
WHERE HSPPROG.EPG.PKEY = HSPPROG.EVE.PKEY AND HSPPROG.EPG.EPSD = HSPPROG.EVE.EPSD AND (HSPPROG.EVE.EVT IN ('AD', 'TR', 'DS', 'HM'))
AND (HSPPROG.EVE.MODU = 'INP') AND (HSPPROG.EPG.PKEY = ?) AND (HSPPROG.EPG.ADDT = ?)
This code is for the lk_MAT_AD lookup:
Code:
SELECT HSPPROG.EPG.PKEY, HSPPROG.EPG.EPSD, HSPPROG.EPG.ADDT, HSPPROG.EPG.ADTM, HSPPROG.EVE.EVT, HSPPROG.EPG.CONS,
HSPPROG.EPG.SPCD, HSPPROG.EPG.WKEY, HSPPROG.EVE."DATE", HSPPROG.EVE."TIME", HSPPROG.EPG.INTN, HSPPROG.EPG.ADSC,
HSPPROG.EPG.ADMT, HSPPROG.EPG.DSMT, HSPPROG.EPG.DSDS, HSPPROG.EPG.EPEN, HSPPROG.EPG.EETM, HSPPROG.EPG.STAT,
HSPPROG.EVE.TWHE, HSPPROG.EVE.CHR1
FROM HSPPROG.EPG, HSPPROG.EVE
WHERE HSPPROG.EPG.PKEY = HSPPROG.EVE.PKEY AND HSPPROG.EPG.EPSD = HSPPROG.EVE.EPSD AND (HSPPROG.EVE.EVT = 'AD') AND
(HSPPROG.EVE.MODU = 'MAT') AND (HSPPROG.EPG.PKEY = ?) AND (HSPPROG.EPG.ADDT = ?)
It sends two values PKEY and ADDT to two lookups which return and population the fields in the array. Now this is find and great but it is only populating one instance for PKEY and ADDT, where as PKEY and ADDT can be the same but the ENT can be different.
In other words i need the DTS to write the other instances of the same PKEY and ADDT until the end of all the instances, and then move onto the next PKEY and ADDT.
Hope this makes sense, and any help would be gratful.
Thanks