ActiveX -
11-24-2005
, 05:56 AM
Can anyone help? I'm trying to right out multiple comment records in 40 byte
chunks this code seems to be working but the Comments are not getting
commited to the target database. Am I misunderstanding how Skip_fetch works?
'************************************************* *********************
' Visual Basic Transformation Script
'************************************************* ***********************
dim LineNumber
dim Comment
dim CommentOut
dim CommentSub
dim OrderID
Function preSourceMain()
LineNumber = 0
Comment = DTSSource("PackingNote")
OrderID = DTSSource("OrderID")
end Function
' Copy each source column to the destination column
Function Main()
if OrderID <> DTSSource("OrderID") then 'Output Comments for the last Order
while len(Comment) > 0
LineNumber = LineNumber + 1
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("Apex_Order_Number") = DTSSource("OrderID")
DTSDestination("LineNumber") = LineNumber
DTSDestination("Apex_Product_Code") = ""
DTSDestination("Apex_Comment") = CommentOut
DTSDestination("Required_Quantity") = 0
Main = DTSTransformStat_SkipFetch
msgbox("Skip Fetch Fired: " + cstr(CommentOut))
wend
Comment = DTSSource("PackingNote")
OrderID = DTSSource("OrderID")
LineNumber = 0
end if
LineNumber = LineNumber + 1
DTSDestination("Apex_Order_Number") = DTSSource("OrderID")
DTSDestination("LineNumber") = LineNumber
DTSDestination("Apex_Product_Code") = DTSSource("ProductID")
DTSDestination("Apex_Comment") = ""
DTSDestination("Required_Quantity") = DTSSource("Quantity")
Main = DTSTransformStat_OK
End Function |