dbTalk Databases Forums  

ActiveX

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss ActiveX in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Spike
 
Posts: n/a

Default 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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.