Tuesday, March 27, 2012

Foreach Loop Container does not iterate automatically

Hi,

Another classic example of something silly I must be doing Sad

I have a "Foreach Loop Container" which uses a "Foreach ADO Enumerator".

The object source is a recordset variable.

Inside the "Foreach Loop Container", a lot of things are happening - some Execute SQL Tasks, Send Mail Tasks, Script Tasks and also a couple of Sequence Containers.

Now, I am getting 2 records in the recordset, but, the "Foreach Loop Container" executes just once.

Any Ideas?

Thanks in advance.

Regards,

B@.ns

There could be some criteria not being met in one of the tasks for the 2nd record. Just to test the loop execution I would recommend making a copy of your package and delete most of the tasks and leave behind just a couple of tasks; maybe an Excecute SQL Task and a Flat File Manager to write the records to (do not overwrite the file). You can then check if the loop is executing twice.

This may be a dumb idea but when you have a lot going on inside a loop it is hard to say what is going on with the loop control. I cannot see any reason why the loop would not execute for the second record.

|||

Hi,

Well, I didn't do much and the Foreach Loop Container is working now. It is indeed looping through all the available records.

No clue as to why and how. Sad

Thanks for replying!

Regards,

B@.ns

No comments:

Post a Comment