Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Running.

Status
Not open for further replies.

dhulbert

Technical User
Jun 26, 2003
1,136
GB

I have a package that contains 3 items, 1 Active x script and 2 Execute SQL tasks.
I'm trying to get the SQl tasks to run dependant on the status of a variable that gets set as part of the active x script

so if a<100 then run SQL task1 and if a>=100 run SQl task 2
I'm sure it shouldn't be that hard to do but the pre xmas brain shut down has kicked in and I cnat seem to work it out, any help would be great.

Thanks in advance.

I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
 
Add a precedence constraint between the script task and the execute sql task. Right click it and choose edit. Then, in Evaluation Operation, choose either Expression or Expression And Constraint.

Expression is where you evaluate your variable. However, this is a 1 value only, so if your criteria is met in the Script task, use the last item in the Script task to set a variable's value. I usually use the good ole bit-like logic. @Var = 1 if TRUE or @Var = 0 if FALSE, but you can literally set a var to TRUE or FALSE or YELLOW or 1245geeg if you want.

The Constraint part is whether or not this precendence constraint should evaluate failure of the script task or success. If you want to evaluate only on the variable, choose only Expression. If you want to evaluate Success (or failure) of Script Task and variable, choose Expression And Constraint.

Does that help?



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 

Cheers for the reply, I'll give it a try after christmas and let you know hot it goes.

Cheers and have a god one.

I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
 

Or even "have a good one"......

I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
 
I've given it a try but I either get an error message in the script or when I try to set the expression it tells me it cant see the expression.

Heres a short version of the script

Code:
Function Main()
    Dim fs, f, f1, fc, s
    a = 0
    x = 0
    declare @var nvarchar(1)

[i] other code removed [/i]

If a = 73 Then set @var = 1  
Else set @var = 0
End If
 
End Function

I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
 
What's the error message?

Also, are you setting @Var to an actual package variable then? You may have to do this and then use the package variable as the Expression part of the conditional precendence.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top