Part 1 explained how to download RSS feeds and save them into a folder. This part covers how to wait for all downloads to complete and iterate through all downloaded files.
Wait until all downloads are completedIn the previous part we created several independent script tasks to download RSS feeds. They are executed concurrently. Before we can import the data we have to wait till all script tasks are finished. The logical object, which represents all tasks as a whole is the Sequence Container. It will be used later to define
the Precedence Constraint.(blue arrow in the image)
1. Create a new Sequence Container
2. Put all Script Tasks into the sequence container
3. Make sure the properties FailPackageOnFailure and FailParentOnFailure are set to 'False' because we don't want the package to fail when a single website is temporarily offline.
All script tasks put into a sequence container:
Iterate through all downloaded XML filesThe Foreach Loop Container iterates through all files in a specified folder
and passes the filename as a parameter to another Script Task, which imports the
1. Create a Foreach Loop Container and edit it using the Container Editor
2. On the Collection page choose the file-enumerator
3. Enter the path of the folder where the downloaded RSS feeds are saved
4. Enter into the field Files: *.xml
5. Select full qualified filenames
6. On the Variables Mappings Page create a new variable with index 0 and name
'CurrentFilePath'. It should be located in namespace 'Package' and should be of
7. Done, click OK to close the editor.
Add the Precedence ConstraintIn this step we add the precedence constraint, which tells the foreach loop
container to start iterating through all files when the downloads are completed.
Though the foreach loop ist still empty. The XML import task will be added in
the next step.
1. Click on the Sequence Container, we created earlier and wait for the green
arrow to appear
2. Drag and drop the green arrow on the Foreach Loop Container
3. Right click on the green arrow and choose edit.
4. Set it's Evaluation Expression to Constraint
5. Set it's Value to Completion
6. Select Logical AND and click on OK to close the Editor
Create the Script Taks for the XML import task1. Create a Script Task and place it inside the Foreach Loop Container
2. Right click on it and choose edit
3. Insert 'CurrentFilePath' into the ReadOnlyVariables Property
4. Click on OK to close the editor
The package should now look like the image below.
Package with empty Script Task for the XML import: