Writing a transformed row several times for each input row

Writing a transformed row several times for each input row

Post by Dirc » Fri, 27 Jun 2003 00:10:57



Folks,

I am trying to prepare a load of test files for testing purposes. The
idea is to upsize the data so that for each row in the input file we
generate say 6 rows of data for an output file, with a slight
alteration in one of the columns. (genrate a new SKU)

The problem is, I can't quite see how to do this...
DTSTransformStat_SkipFetch does the same transform on the same
destination and source columns... and I cannot quite see how to write
out a destination row without moving the source row....

I suppose I could write a script to do this for me, but I have lots of
DTS packages and a framework for running them from my app, so I would
rather use DTS...

Any Ideas?

Dirc
MCAD

 
 
 

Writing a transformed row several times for each input row

Post by Dirc » Fri, 27 Jun 2003 02:37:57


So, to answer my own question:

The documentation is not very clear...  you can use
DTSTransformStat_SkipFetch to add rows:

Here is my sample code:

'**********************************************************************
'  Upsize Transform
'************************************************************************

Option Explicit

'  Copy each source column to the destination column
Function Main()
Dim dataRow
Dim dataLength
Dim outDataRow
Dim indicatorIndex
Dim currentIteration

        dataRow = DTSSource("Col001")

        currentIteration = DTSGlobalVariables("currentIteration")
        'MsgBox currentIteration

        If CLng(DTSTransformPhaseInfo.CurrentSourceRow) = 1 Then
                'Header: leave untransformed
                DTSDestination("Col001") = DTSSource("Col001")
                DTSDestination("Col002") = DTSSource("Col002")
                DTSGlobalVariables("currentIteration") = 1
                Main = DTSTransformStat_OK
                Exit Function
        Else    
                If Left(dataRow,3) = "PPM" Then
                        'Footer: leave untransformed
                        DTSDestination("Col001") = DTSSource("Col001")
                        DTSDestination("Col002") = DTSSource("Col002")
                Else
                        DTSDestination("Col001") = DTSSource("Col001")
                        if currentIteration =  1 Then
                        DTSDestination("Col001") = DTSSource("Col001")
                        Else
                        DTSDestination("Col001") = DTSSource("Col001")
+ (10000 * (currentIteration - 1))
                        End If
                End If
        End If

        If currentIteration < DTSGlobalVariables("UpsizeFactor") Then

                Main = DTSTransformStat_SkipFetch
                DTSGlobalVariables("currentIteration") =
currentIteration + 1
        Else
                DTSGlobalVariables("currentIteration") = 1
                Main = DTSTransformStat_OK
        End If
End Function



Quote:

>Folks,

>I am trying to prepare a load of test files for testing purposes. The
>idea is to upsize the data so that for each row in the input file we
>generate say 6 rows of data for an output file, with a slight
>alteration in one of the columns. (genrate a new SKU)

>The problem is, I can't quite see how to do this...
>DTSTransformStat_SkipFetch does the same transform on the same
>destination and source columns... and I cannot quite see how to write
>out a destination row without moving the source row....

>I suppose I could write a script to do this for me, but I have lots of
>DTS packages and a framework for running them from my app, so I would
>rather use DTS...

>Any Ideas?

>Dirc
>MCAD

Dirc
MCAD