Ah, thanks for the clarification. I just wanted to make sure that you weren't just using the Script Component because it was there. You never know what someone's experience level is and therefore their motives behind doing things a certain way. Because of that, I find it easier to just ask why instead of assuming there is a good reason.
Yes, if you have to parse a non-delimited text file, a Script Component is the best way to do it.
As for the OnError Handler, you don't need another script task to set the Propogate variable value. Here's how to prevent an error from halting your package execution. These steps need to be done for each Control Flow object inside of your For Each container:
1. Left-click task to set the focus on it.
2. Go to the Event Handlers tab.
3. Ensure that the Event Handler drop-down box has the OnError event selected. By default, the screen will be grayed out with a blue message "Click here to create an 'OnError event handler for executable 'Your Task Name'" in the center of the screen.
4. Mouse click anywhere in the grayed out screen.
5. At this point, you could add in tasks that would fire in the event of your task returning an error. You can configure it to send e-mail notifications, log error values to a table, or a host of other actions. For what we want to do; however, you don't need to drag any tasks into the view. Instead, click on the variables tab. This will display all of the variables that you have access to inside the Event Handler. You'll want to make sure you select the 'Show System Variables' option.
6. Find the variable labeled Propagate (you'll notice it is scoped to the OnError event handler). Set the value to 'False'.
7. At this point, any error generated by this task will halt the execution of the For Each loop's current iteration. The For Each loop will continue execution with the next item in the collection. Keeping this value set to 'True' (the default) will completely halt the execution fo the For Each container.
Hope this helps, let me know if you have any questions or concerns.
====================================================== Forum Etiquette: How to post data/code on a forum to get the best help
- by Jeff Moden