SQL Server - Assign Global var in Transformation Active X

Asked By Bill W
17-Nov-09 11:53 AM
Hey,
I have an import from a flat file that has 70 plus rows. One row's
counterpart is an int. One row failed, it contained a space, where the
acceptable values are 0, 1, 2, and 3. Business rules state if two
other fields = zeros, I can put a 0 in the field.
How can I check DTSSource("002") and DTSSource("017")'s values at
DTSSource("027")'s transformation step?
I tried creating Globals and at 002 create an extra transform that
sets DTSGlobalVarialbes("ArNumber").value = DTSSource("002"). I do not
get the value of 002 in the Global. I put a MsgBox display and it
shows the value... but it apparently does not stay valid until 027!
Same with other field.
Is this even possible? Any Ideas?

Thanks,
Bill
DTSGlobalVarialbes
(1)
DTSSource
(1)
ArNumber
(1)
Comparisons
(1)
Refrence
(1)
Datapump
(1)
Zeros
(1)
Stmts
(1)
  Bill W replied to Bill W
19-Nov-09 05:16 PM
Ok, I figured it out... You do not have to use a Global Var.  Just
refrence the colums in the datapump transform step and you can check
the values of those columns (002, 0017,...) then do your comparisons
on those colums to match your criteria, use your If-Then-Else stmts to
do your work.  Actually pretty simple.  :)
Thanks for trying....
Bill
help
Copy each source column to the ' destination column '* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** * dim datum1 dim datum2 Function Main() datum1 = DTSSource("ABTERM") datum2 = DTSSource("BESTDATUM") If year(datum1) < 1990 Then datum1 = cdate( "01.01.1900" ) end if If year datum2) < 1900 Then datum2 = cdate( "01.01.1900" ) end if DTSDestination("BESTNR") = DTSSource("BESTNR") DTSDestination("POS") = DTSSource("POS") DTSDestination("BURNR") = DTSSource("BURNR") DTSDestination("LAGERBER") = DTSSource("LAGERBER") DTSDestination("FARBNR") = DTSSource("FARBNR") DTSDestination("ARTBEZ1") = DTSSource("ARTBEZ1") DTSDestination("ARTBEZ2") = DTSSource("ARTBEZ2") DTSDestination("ANRDLIEF") = DTSSource("ANRDLIEF") DTSDestination("VERPAKT_ZU") = DTSSource("VERPAKT_ZU") DTSDestination("MENGENEINH
Transformation Script ' Copy each source column to the ' destination column '* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** * Function Main() DTSDestination("FORM-NUMBER") = DTSSource("Col001") + DTSSource("Col002") + DTSSource("Col003") DTSDestination("FORM-YEAR") = DTSSource("Col001") DTSDestination("WA-JOB-NUM") = DTSSource("Col006") DTSDestination("DISTRICT") = DTSSource("Col007") DTSDestination("WORK-DISTRICT") = DTSSource("Col008") ' DTSDestination("WORK-DATE") = DTSSource("Col009") If IsDate(mid(DTSSource("Col009"), 1, 4) & " / " & mid(DTSSource("Col009"), 5, 2) & " / " & mid(DTSSource
DATEDIFF(dd, 0, ServerTimeStamp)) = DATEADD(dd, 0, DATEDIFF(dd, 0, NOW())) - 1) THEN DTSDestination("ID") = DTSSource("ID") DTSDestination("Direction") = DTSSource("Direction") DTSDestination("ServerTimeStamp") = DTSSource("ServerTimeStamp") DTSDestination("Quality") = DTSSource("Quality") DTSDestination("Agency") = DTSSource("Agency") DTSDestination("LoggedOn") = DTSSource("LoggedOn") Main = DTSTransformStat_OK ELSE Main = DTSTransformStat_SkipRow END IF End Function Thank you for any help with this. RBollinger SQL Server DTS Discussions SQL Server 2000 (1) DTSTransformStat (1) DTSSource (1) ServerTimeStamp (1) TargetTable (1) SourceTable (1) LoggedOn (1) SkipRow (1) The error message is