Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Conditional statement in a control flow Expand / Collapse
Author
Message
Posted Wednesday, July 15, 2009 12:30 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, July 18, 2009 5:10 PM
Points: 23, Visits: 49
To preface, I am a newbie to SSIS. I would like to do the following but can not figure out how, any help would be appreciated.

I want to read multiple XML source files through a foreach loop. First looking to see if one field in the file exists and if so going to a data flow task and if it does not exists moving the file through File System Task and going to the next file.

I am aware of the conditional split data flow but how do I do a conditional statement in the control flow?

Thanks in advance.




Post #753719
Posted Wednesday, July 15, 2009 2:47 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, October 16, 2014 2:19 AM
Points: 265, Visits: 260
Hi Michael,

You can use the variable expressions within the precedents constraints. You can store the results you want to check into a variable and then use this variable in an expression like (@varName == true) within the precedents constraints which then splits the flow to the tasks of your choice.

see msdn online : http://msdn.microsoft.com/en-us/library/ms140153(SQL.90).aspx


Post #753832
Posted Wednesday, July 15, 2009 2:54 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, July 18, 2009 5:10 PM
Points: 23, Visits: 49
Thank You.

Can I set a variable within the data flow task after a conditional split without using a script component (not sure how to write the code to do that)?

I was going to use XML source to a conditional split and then I want to set a variable to true or false based on the split. What is the easiest way to do that, w/o script code? Or if I need to use script code can you tell what it would be to just set a variable to true or false?

Thanks
Post #753840
Posted Wednesday, July 15, 2009 9:20 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 2:15 AM
Points: 5,317, Visits: 12,354
Assume that you have a Boolean variable called Test. Here is how you would set it to True using a Script Task.

1) Create a Script Task.
2) Add 'User::Test' (no quotes) to the ReadWriteVariables property.
3) Modify the definition of Public Sub Main as follows:

  Public Sub Main()

Dts.Variables("Test").Value = True

Dts.TaskResult = Dts.Results.Success
End Sub

(Leave the rest of the Script Task code untouched.)

Job done.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.

It is better to keep your mouth shut and appear stupid than to open it and remove all doubt. (Mark Twain)
Post #753937
Posted Wednesday, July 15, 2009 9:35 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, July 18, 2009 5:10 PM
Points: 23, Visits: 49
Thank You!
Post #753938
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse