SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Conditional statement in a control flow


Conditional statement in a control flow

Author
Message
michael.mcspadden
michael.mcspadden
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 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.
Micha van der Ende
Micha van der Ende
SSC Veteran
SSC Veteran (295 reputation)SSC Veteran (295 reputation)SSC Veteran (295 reputation)SSC Veteran (295 reputation)SSC Veteran (295 reputation)SSC Veteran (295 reputation)SSC Veteran (295 reputation)SSC Veteran (295 reputation)

Group: General Forum Members
Points: 295 Visits: 283
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
michael.mcspadden
michael.mcspadden
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 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
Phil Parkin
Phil Parkin
One Orange Chip
One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)

Group: General Forum Members
Points: 25642 Visits: 20678
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
michael.mcspadden
michael.mcspadden
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 Visits: 49
Thank You!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search