Solved

DTS (ActiveX) Error

Posted on 2008-10-14
4
227 Views
Last Modified: 2008-10-20
Am editing an existing (and working) transformation.
The script parsing fine (no idea if my logic is correct yet) but when I test it or run it I get the error that "Function 'in' was not found in the script".

At first I assumed it was a typo but I can't see it! If not a typo then what could it be?
I have removed the indentation from the code snippet so it reads better in the code snippet window.... makes the if, else, end a bit tricker to follow tho :(
'**********************************************************************
'Visual Basic Transformation Script
'************************************************************************
 
'Copy each source column to the destination column
Function Main()
if DTSSource("CHART_NAME")= "GGLCHART" OR DTSSource("CHART_NAME") = "GJCCHART" THEN
if len(DTSSource("ACCNBRI")) = 11 then
if mid(DTSSource("ACCNBRI"),6,6) <> "&&&&&&" then
 
DTSDestination("column1") = left(DTSSource("Chart_Name"),2)
DTSDestination("column1")= DTSDestination("column1")& mid(DTSSource("ACCNBRI"),6,6)& "1000"
 
DTSDestination("column2") = mid(DTSSource("DESCR2"),1,15)& " "&mid(DTSSource("DESCR1"),1,30)
DTSDestination("column2") = ltrim(mid(DTSDestination("column2"),1,30) )
 
DTSDestination("column3") = DTSDestination("column1")
DTSDestination("column4") = DTSDestination("column2")
 
Main = DTSTransformStat_OK
else
if mid(DTSSource("ACCNBRI"),3,3) <> "&&&" then
 
DTSDestination("column1") = left(DTSSource("Chart_Name"),2)
DTSDestination("column1")= DTSDestination("column1")& "000000" & mid(DTSSource("ACCNBRI"),3,3) & "0"
 
DTSDestination("column2") = mid(DTSSource("DESCR2"),1,15)& " "&mid(DTSSource("DESCR1"),1,30)
DTSDestination("column2") = ltrim(mid(DTSDestination("column2"),1,30) )
 
DTSDestination("column3") = DTSDestination("column1")
DTSDestination("column4") = DTSDestination("column2")
 
Main = DTSTransformStat_OK
 
end if
end if
else
if mid(DTSSource("ACCNBRI"),1,6) <> "&&&&&&" then
 
DTSDestination("column1") = left(DTSSource("Chart_Name"),2)
DTSDestination("column1")= DTSDestination("column1")& mid(DTSSource("ACCNBRI"),1,6) & "1000"
 
DTSDestination("column2") = mid(DTSSource("DESCR2"),1,15)& " "&mid(DTSSource("DESCR1"),1,30)
DTSDestination("column2") = ltrim(mid(DTSDestination("column2"),1,30) )
 
DTSDestination("column3") = DTSDestination("column1")
DTSDestination("column4") = DTSDestination("column2")
 
Main = DTSTransformStat_OK
 
else
Main = DTSTransformStat_SkipRow
end if
end if
 
 if DTSSource("CHART_NAME") = "GGLCHT" then
if (left(DTSSource("ACCNBRI"),3) = "&&&" AND right(DTSSource("ACCNBRI"),6) = "&&&&&&" AND mid(DTSSource("ACCNBRI"),4,3) <> "&&&") then
DTSDestination("column1") =mid(DTSSource("ACCNBRI"),4,3) 
DTSDestination("column2") = mid(DTSSource("DESCR2"),1,15)& " "&mid(DTSSource("DESCR1"),1,30)
DTSDestination("column2") = ltrim(mid(DTSDestination("column2"),1,30) )
DTSDestination("column3") = DTSDestination("column1")
DTSDestination("column4") = DTSDestination("column2")
Main = DTSTransformStat_OK
else
Main = DTSTransformStat_SkipRow
end if
end if
 
 
 if DTSSource("CHART_NAME") = "GNJCCHT" then
if mid(DTSSource("ACCNBRI"),3,6) <> "&&&&&&" then
DTSDestination("column1") = left(DTSSource("ACCNBRI"),8)
DTSDestination("column2") = mid(DTSSource("DESCR2"),1,15)& " "&mid(DTSSource("DESCR1"),1,30)
DTSDestination("column2") = ltrim(mid(DTSDestination("column2"),1,30) )
DTSDestination("column3") = DTSDestination("column1")
DTSDestination("column4") = DTSDestination("column2")
Main = DTSTransformStat_OK
else
Main = DTSTransformStat_SkipRow
end if
end if
end if
End Function

Open in new window

0
Comment
Question by:QPR
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 27

Expert Comment

by:Zberteoc
ID: 22722991
Sim misplaced "end if"s, i think. Try this:
'**********************************************************************
'Visual Basic Transformation Script
'************************************************************************
 
'Copy each source column to the destination column
Function Main()
 
	if DTSSource("CHART_NAME")= "GGLCHART" OR DTSSource("CHART_NAME") = "GJCCHART" THEN
		if len(DTSSource("ACCNBRI")) = 11 then
			if mid(DTSSource("ACCNBRI"),6,6) <> "&&&&&&" then
 
				DTSDestination("column1") = left(DTSSource("Chart_Name"),2)
				DTSDestination("column1")= DTSDestination("column1")& mid(DTSSource("ACCNBRI"),6,6)& "1000"
				 
				DTSDestination("column2") = mid(DTSSource("DESCR2"),1,15)& " "&mid(DTSSource("DESCR1"),1,30)
				DTSDestination("column2") = ltrim(mid(DTSDestination("column2"),1,30) )
				 
				DTSDestination("column3") = DTSDestination("column1")
				DTSDestination("column4") = DTSDestination("column2")
				 
				Main = DTSTransformStat_OK
			else
				if mid(DTSSource("ACCNBRI"),3,3) <> "&&&" then
					 
					DTSDestination("column1") = left(DTSSource("Chart_Name"),2)
					DTSDestination("column1")= DTSDestination("column1")& "000000" & mid(DTSSource("ACCNBRI"),3,3) & "0"
					 
					DTSDestination("column2") = mid(DTSSource("DESCR2"),1,15)& " "&mid(DTSSource("DESCR1"),1,30)
					DTSDestination("column2") = ltrim(mid(DTSDestination("column2"),1,30) )
					 
					DTSDestination("column3") = DTSDestination("column1")
					DTSDestination("column4") = DTSDestination("column2")
					 
					Main = DTSTransformStat_OK
					 
				end if
			end if
		end if
	else
		if mid(DTSSource("ACCNBRI"),1,6) <> "&&&&&&" then
		 
			DTSDestination("column1") = left(DTSSource("Chart_Name"),2)
			DTSDestination("column1")= DTSDestination("column1")& mid(DTSSource("ACCNBRI"),1,6) & "1000"
			 
			DTSDestination("column2") = mid(DTSSource("DESCR2"),1,15)& " "&mid(DTSSource("DESCR1"),1,30)
			DTSDestination("column2") = ltrim(mid(DTSDestination("column2"),1,30) )
			 
			DTSDestination("column3") = DTSDestination("column1")
			DTSDestination("column4") = DTSDestination("column2")
			 
			Main = DTSTransformStat_OK
		 
		else
			Main = DTSTransformStat_SkipRow
		end if
	end if
 
 
	if DTSSource("CHART_NAME") = "GGLCHT" then
		if (left(DTSSource("ACCNBRI"),3) = "&&&" AND right(DTSSource("ACCNBRI"),6) = "&&&&&&" AND mid(DTSSource("ACCNBRI"),4,3) <> "&&&") then
 
			DTSDestination("column1") =mid(DTSSource("ACCNBRI"),4,3) 
			DTSDestination("column2") = mid(DTSSource("DESCR2"),1,15)& " "&mid(DTSSource("DESCR1"),1,30)
			DTSDestination("column2") = ltrim(mid(DTSDestination("column2"),1,30) )
			DTSDestination("column3") = DTSDestination("column1")
			DTSDestination("column4") = DTSDestination("column2")
			Main = DTSTransformStat_OK
 
		else
			Main = DTSTransformStat_SkipRow
		end if
	end if
	 
 
	if DTSSource("CHART_NAME") = "GNJCCHT" then
		if mid(DTSSource("ACCNBRI"),3,6) <> "&&&&&&" then
 
			DTSDestination("column1") = left(DTSSource("ACCNBRI"),8)
			DTSDestination("column2") = mid(DTSSource("DESCR2"),1,15)& " "&mid(DTSSource("DESCR1"),1,30)
			DTSDestination("column2") = ltrim(mid(DTSDestination("column2"),1,30) )
			DTSDestination("column3") = DTSDestination("column1")
			DTSDestination("column4") = DTSDestination("column2")
			Main = DTSTransformStat_OK
 
		else
			Main = DTSTransformStat_SkipRow
		end if
	end if
 
End Function

Open in new window

0
 
LVL 29

Author Comment

by:QPR
ID: 22724512
same error - Function "in" was not found in the script
0
 
LVL 29

Author Comment

by:QPR
ID: 22724744
I deleted the transformation and repasted the activex back in and tested it (I should add that it parses just fine).
This time I get a new error....

script function 'main' returned an invalid DTStransformstatus value, or an activex script did not return an integral type. No further work will be done by the datapump.

huh?
0
 
LVL 29

Accepted Solution

by:
QPR earned 0 total points
ID: 22727654
hmmm solved it. Disconnected edit - task.
Step 1 had an entry point of "in" instead of "main"
somehow!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
encrypt SQL Server 2008 port 1433 3 48
SQL: get ride of blank rows 11 21
T-SQL: Number of Records is Greater Than One 7 51
SQL Query 20 22
I have a large data set and a SSIS package. How can I load this file in multi threading?
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question