March 23, 2009 at 7:16 am
I am not familiar with VB Script but I'm in the process of learning it while doing this project.
I have an Import Package that takes a CSV file and imports the data into a table.
The destination column should be a decimal(12,2). The source data is a string/varchar. The DTS package has a an Active X script transformation that is being used. Below is the code. I am only changing one column and that is the SSL_Amount column.
When I run this the package successfully executes however when I review the data the '$' is not replaced with '#'. Really I'd like to replace the '$' and the ',' with blank values but I tried the '#' symbol cause I didn't get any results with a blank value. Neither have worked.
Once I get the replace working I need to convert this string to a decimal. I'm not sure what command I'll need to use for that.
Any ideas on why the below syntax runs successfully but does not actually change the data? TIA.
Function Main()
DTSDestination("transactionid") = DTSSource("transactionid")
DTSDestination("transactiontype") = DTSSource("transactiontype")
DTSDestination("transactiondatetime") = DTSSource("transactiondatetime")
DTSDestination("ssl_amount") = DTSSource(replace("ssl_amount","$","#"))
DTSDestination("ssl_invoice_number") = DTSSource("ssl_invoice_number")
Main = DTSTransformStat_OK
End Function
March 23, 2009 at 7:39 am
Okay I figured it out. While the above command successfully runs but doesn't change the data the problem was I need to put the replace command in front of the "DTSSource" like this:
replace(DTSSource("ssl_amount"),"$","#")
March 23, 2009 at 10:11 am
Thanks for the update, and glad you got it working.
Just remember the DTSSource() is a function, and represents a field of data. You want your other function to enclose that entire thing.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply