tags:

views:

18

answers:

1

Hi,

I have a row count inside a foreach. I want the variable to have the total number of records that passed through in all iterations of the for each - cumulative sum. However, it seems that only the last iteration holds. Is there a way to do this?

Thanks

+1  A: 

A Row Count component appears in a Data Flow task, not a Foreach task. So, I assume you have a Data Flow task in the Foreach task.

The Row Count component only captures the count for the current run of the Data Flow task. There isn't an inherent way to capture the cumulative total; so, you will have to do it yourself. One way is to create another variable to store the cumulative total and a Script task that adds the Row Count variable to the cumulative count variable. The new Script task would appear in the Foreach task and follow the Data Flow task.

bobs

related questions