Exiting ForEach prematurely

  • My code grabs records from the db and loops through them, performing actions for each one. One of those actions is to grab other values from the db and store them in an object variable. A sub-foreach loop would then loop through the values in that object and send an email for each, but that task never executes. The task before the sub-loop completes successfully, and then the outer loop completes it's iteration and moves on. The sub-loop, and all tasks that should occur after it, never fire. No success or failure according to the execution results, just validation. When I throw a breakpoint on the sub-loop it never fires. The package as a while completes successfully. The constraints on the sub-loop say it should fire on the success of the preceding task. I've used a script task to verify that the object variable did hold the correct values.

    I can't spot the problem. Any thoughts?

  • A picture would be handy.
    Are the constraint lines full lines (all success) or dotted (any success)?

  • I figured it out earlier this morning.  You're exactly right.  That task had more than one avenue to it, and I had neglected to set the constraint to OR (any success), so of course it wouldn't fire when only one of the precedent tasks completed successfully.

    Thanks!

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

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