by jking Fri Mar 23, 2018 3:57 am
You will need 2 variables. One variable for the Sum, and one variable for the Extracted Value. Note that the variable for the Sum must be Global.
Extract your value from the CSV. You next step would be an Assign Variable step using an Expression.
Expression value would be SumVariable+ExtractedValue. Note that the order is critical.
When you Execute the Assign Variable Step, the SumVariable will be the product of the SumVariable + Extracted Value.
Initially the value of the SumVariable will be blank. SumVariable+ExtractedValue will result in a value of the ExtractedValue.
Extract your next value and add another Assign Variable Step with the same expression SumVariable+ExtractedValue, the SumVariable will now have the product of both of the extracted values. You can continue this pattern as often as necessary to sum all values.
An alternate method would be to create a Type that contains variables that match your CSV, and then Create a Database Table based on the Type.
Extract each value into the Type and use a StoreInDatabase step.
Once you have finished looping your CSV, you can add a QueryDatabase step and write an SQL statement to sum the individual values.