cancel
Showing results for 
Search instead for 
Did you mean: 

how to sum rows of a specific column from a collection

Hello everyone!

I'm trying to get the total amount from a column of a Collection without looping (with Collections of 5000 Rows memory issues could appear). The only way to do this is by using a code stage, but i'm kind of lost on this... 

For example: A collection with 1200 Rows I want to get the total amount of "X" Column:
X Column is text type, so each value I have to convert it to integer ...

what i tried was using LinQ with this code that i found on internet;
Dim total = dt.AsEnumerable().Sum(Function(t) t.Field(Of Integer)("X"));
The Code Options was this;
20425.png

When I run the action it throws an error Internal : Exception: Object reference not set to an instance of an object..

I think I'm missing something with the code ( I dont know VB :c ) or the reference but I dont know what.

Is there any better way to accomplish this? What am i doing wrong? 


------------------------------
Daniel Sanhueza
Analyst
Deloitte
America/Santiago
------------------------------
Daniel Sanhueza
RPA Professional Developer
Deloitte
0 REPLIES 0