Marc Alexander
Marc Alexander

Reputation: 27

SSIS Foreach Loop Container only goes through 1 iteration in design environment

I have a ForEach Loop Container that is supposed to iterate through the records in an Ado Enumerator. The Enumberation mode = Rows in the first table.

I built a Script Task to write a MessageBox for each iteration. It only shows the message for the 1st iteration. After that it hangs.

I tried building the solution and running the package and it works fine. But in the development/design realm it still hangs.

Is that how it's supposed to work in the design mode? How can I test things downstream of the Foreach container if it's going to hang when I debug it?

Upvotes: 2

Views: 2374

Answers (3)

grail
grail

Reputation: 1

I also encounter this and i made it work.

  1. be sure put your variable in the ReadOnlyVariable field - the field you want to show in the message box inside the script task.
  2. Remark or remove this statement in the script task: Dts.TaskResult = (int)ScriptResults.Success; i think it affects the process because its giving a success result.

hope it helps.

Upvotes: 0

billinkc
billinkc

Reputation: 61269

When SSIS is running in Visual Studio/BIDS/SSDT and it just seems to hang, especially if there's a script task, look at the task bar. 11/10 a dialog has popped up indicating you have an error in your code.

As you are popping message boxes, the first one will get focus as it opens but the subsequent ones do not automatically gain focus.

My personal preference is to FireInformation events over message boxes as they work whether the process is running in attended versus unattended mode. Example over here

Upvotes: 3

Tab Alleman
Tab Alleman

Reputation: 31785

No, the ForEachLoop works the same way in Design Mode as it does when deployed to a server. If you are seeing it only iterate once, then the most likely explanation is that there is only one item to iterate over, and your data isn't what you think it is.

As suggested in a comment, you can put a break point on some point before and/or during your loop, and use Watches to peek into your variables to see what their values are. This should allow you to see why your ADO object only contains a single item.

Upvotes: 0

Related Questions