Accessing the ForEach container enumerator value

  • Basic question but how do I get the number of files processed by a ForEach container? I want to send a notification if I expect files to be in a folder but there aren't any.

    Thanks,

    Matt

  • MattQ (4/8/2009)


    Basic question but how do I get the number of files processed by a ForEach container? I want to send a notification if I expect files to be in a folder but there aren't any.

    Thanks,

    Matt

    Matt,

    The ForEach container cannot provide this information. You can create a script, which does this for you:

    1. Setup integer package variable for your counter.

    2. Insert a script task in the foreach container, at the end of processing.

    3. Create a script. Setup ReadWriteVariables property to the counter variable.

    4. Increment the variable with script similar to this:

    Dim counter As Integer = CType(Dts.Variables("Counter").Value, Integer)

    Dts.Variables("Counter").Value = counter + 1

    Give it a try and let us know how it goes.

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • I'll give it a go. Thanks!

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

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