dbTalk Databases Forums  

Testing Global Output Variable Value

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


Discuss Testing Global Output Variable Value in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Robert Richards via SQLMonster.com
 
Posts: n/a

Default Testing Global Output Variable Value - 01-14-2005 , 02:38 PM






I have created a task that executes a simple query:
select count(*) from ifsmessages

Within this task I have created an output parameter called gMsgCount with a data type of int. I have given it a parameter type of Row Value.

Next I created an ActiveX object with VBScript language. Eventually I want to create a DTS package that allows the user to execute or not execute the package depending on the value returned in gMsgCount using a YES/NO message box. To test the running of the task and the output value I have written the following:

Function Main()
msgbox "The number of records in table IFSMessages is: " & DTSGlobalVariables("gMsgCount").Value, VBYesNo, "IFSMessages Count"
End Function

When I execute the ActiveX object step I get a VBScript error saying "Variable uses an automation type not supported in VBScript." What am I missing?

--
Message posted via http://www.sqlmonster.com

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Testing Global Output Variable Value - 01-15-2005 , 01:32 AM






OK Here is what I did and it works

select count(*) as Amount from Authors

Assigned the ouput (Row Value) to a GV

In an Active Script task I did exactly as you.



--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Robert Richards via SQLMonster.com" <forum (AT) SQLMonster (DOT) com> wrote

Quote:
I have created a task that executes a simple query:
select count(*) from ifsmessages

Within this task I have created an output parameter called gMsgCount with
a data type of int. I have given it a parameter type of Row Value.

Next I created an ActiveX object with VBScript language. Eventually I want
to create a DTS package that allows the user to execute or not execute the
package depending on the value returned in gMsgCount using a YES/NO
message box. To test the running of the task and the output value I have
written the following:

Function Main()
msgbox "The number of records in table IFSMessages is: " &
DTSGlobalVariables("gMsgCount").Value, VBYesNo, "IFSMessages Count"
End Function

When I execute the ActiveX object step I get a VBScript error saying
"Variable uses an automation type not supported in VBScript." What am I
missing?

--
Message posted via http://www.sqlmonster.com



Reply With Quote
  #3  
Old   
Ed
 
Posts: n/a

Default RE: Testing Global Output Variable Value - 01-15-2005 , 06:59 AM



Why put Vbyesno at the end?
if you want users to choose either Yes/No, you should use

Dim quest
quest = Msgbox ("Are you sure?", VBYesNo)
if quest = vbyes then
....
Else
....

Ed

"Robert Richards via SQLMonster.com" wrote:

Quote:
I have created a task that executes a simple query:
select count(*) from ifsmessages

Within this task I have created an output parameter called gMsgCount with a data type of int. I have given it a parameter type of Row Value.

Next I created an ActiveX object with VBScript language. Eventually I want to create a DTS package that allows the user to execute or not execute the package depending on the value returned in gMsgCount using a YES/NO message box. To test the running of the task and the output value I have written the following:

Function Main()
msgbox "The number of records in table IFSMessages is: " & DTSGlobalVariables("gMsgCount").Value, VBYesNo, "IFSMessages Count"
End Function

When I execute the ActiveX object step I get a VBScript error saying "Variable uses an automation type not supported in VBScript." What am I missing?

--
Message posted via http://www.sqlmonster.com


Reply With Quote
  #4  
Old   
Robert Richards via SQLMonster.com
 
Posts: n/a

Default Re: Testing Global Output Variable Value - 01-17-2005 , 11:59 AM



I am still getting the same error. This is what I have verbatim for my script:

Function Main()
Dim resp

resp = MsgBox("The row count in table IFSMessages is: " & DTSGlobalVariables("gMsgCount").Value, VBYesNo)

if resp = VBYes then
'execute package
else
'do not execute package
end if
Main = DTSTaskExecResult_Success
End Function

When I execute the ActiveX object step I get a VBScript error saying "Variable uses an automation type not supported in VBScript."

Within the ActiveX Script Task properties, Package Object Browser under Global Variables I am able to see the output variable "gMsgBox" that I created in Execute SQL Task.

Within Execute SQL Task my SQL Statement verbatim is:
select count(*) as msgcount from ifsmessages

When I select the Parameters button and then the Output parameters tab, I have Row value output parameter type option selected. Below that I have in Parameter Mapping a parameter of "msgcount" and Output Global Variables as "gMsgCount".

Any idea why I am getting the above error? If I remove the reference to DTSGlobalVariables("gMsgCount").Value in the MsgBox statement the script executes without the error, but obviously I do not get a count because the global variable is not being referenced.

--
Message posted via http://www.sqlmonster.com

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.