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 FunctionProblem sorted. Please ignore...
"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 insid
e
> the loop. The code below works (and the loop is being executed) but nothi
ng
> 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
>
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment