Using same Data Flow task twice in the same package

  • I have a very simple package that drops and recreates a table and then loads two flat files with the same structure into the table.

    However, there is some metadata I want to add to each separate load (values that are contained in package configurations) so ideally, the package would run the data flow task the first time using one package config and then a second time using the second configuration.

    A ForEach task is no doubt required, but how do I execute it a finite number of times, each time using a specific package config?

    If I have to set the variables explicitly during execution (instead of grabbing them from a package config) that would be fine also.

    Seems like this should be fairly straightforward, just need to know the right settings..

    NOTE: Since I originally posted this, it occurred to me that using a ForLoop will allow me to run the Data Flow a finite number of times. Now the remaining question is how to assign specific values to variables on each iteration of the loop, either explicitly or by specifiying a package config.

  • Since no one else has answered I will have a go.

    First configurations are only applied when a package is first loaded (befofe validation) so use of a configuration would only work if your data flow is in a child package - even then Im not sure how you would control which configuration to use - you would probably need to use command line options.

    So its best to use a for loop as you suggested.

    My idea would be inside the for For Loop you set up:

    1. Create all the variables you are going to change in the scope of the For Loop (give them a consistent naming convention)

    2. Place a script task first called "Set Variable Values"

    3. Place your data flow after the scriipt task

    You just put all your logic in the script task. Set the variable values depending on the For Loop iterator. Your Data Flow just references these variable either directly or via expressions.

    I hope that helps and was not too vague.

  • Thanks! will give it a go.. at least I can eliminate taking the path of using package configs dynamically.. you probably saved me a lot of time with futile experimentation..

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply