Home All Groups Group Topic Archive Search About

DTS: Transform Data Task with ActiveX

Author
25 Nov 2005 2:41 PM
Spike
I trying to write out comment records in 40 byte chunks from a much longer
field(see below) but I can't find any way of writing out the records inside
the loop.  The code below works (and the loop is being executed) but nothing
turns up in the output.  Does anyone have any thoughts?

'***********************************************************
'  Visual Basic Transformation Script
'***********************************************************

'  Copy each source column to the destination column
dim Comment
dim CommentOut
dim CommentSub


Function Main()

    if DTSSource("OrderID") <> DTSGlobalVariables("OrderID") then
        '    Process Comments

        Comment = DTSGlobalVariables("Comment")

        Do While len(Comment) > 0
            if len(Comment) > 40 then
                CommentOut = left(Comment,40)
                CommentSub = mid(Comment,41,len(Comment)-40)
                Comment = CommentSub
            else
                CommentOut = Comment
                comment = ""
            end if                       

        DTSDestination("OrderID") = DTSGlobalVariables("OrderID")
        DTSDestination("LineNumber") = DTSGlobalVariables("LineNumber")
        DTSDestination("Comment") = CommentOut

        Main = DTSTransformStat_OK

        Loop               

        '    Store Comment from the record causing the control break
        DTSGlobalVariables("OrderID") = DTSSource("OrderID")
        DTSGlobalVariables("Comment") = DTSSource("PackingNote")

    end if   

Main = DTSTransformStat_OK


End Function

Author
25 Nov 2005 3:16 PM
Spike
Problem sorted.  Please ignore....

Show quote
"Spike" wrote:

> I trying to write out comment records in 40 byte chunks from a much longer
> field(see below) but I can't find any way of writing out the records inside
> the loop.  The code below works (and the loop is being executed) but nothing
> turns up in the output.  Does anyone have any thoughts?
>
> '***********************************************************
> '  Visual Basic Transformation Script
> '***********************************************************
>
> '  Copy each source column to the destination column
> dim Comment
> dim CommentOut
> dim CommentSub
>
>
> Function Main()
>
>     if DTSSource("OrderID") <> DTSGlobalVariables("OrderID") then
>         '    Process Comments
>        
>         Comment = DTSGlobalVariables("Comment")
>        
>         Do While len(Comment) > 0
>             if len(Comment) > 40 then
>                 CommentOut = left(Comment,40)
>                 CommentSub = mid(Comment,41,len(Comment)-40)
>                 Comment = CommentSub
>             else
>                 CommentOut = Comment
>                 comment = ""
>             end if                       
>
>         DTSDestination("OrderID") = DTSGlobalVariables("OrderID")
>         DTSDestination("LineNumber") = DTSGlobalVariables("LineNumber")
>         DTSDestination("Comment") = CommentOut
>        
>         Main = DTSTransformStat_OK
>        
>         Loop               
>        
>         '    Store Comment from the record causing the control break
>         DTSGlobalVariables("OrderID") = DTSSource("OrderID")
>         DTSGlobalVariables("Comment") = DTSSource("PackingNote")
>
>     end if   
>    
> Main = DTSTransformStat_OK
>    
>
> End Function
>
>
>

AddThis Social Bookmark Button