Add all values in a column of a data table

Hi my friends,

¿Is there any way to add all the values of a column of a Data Table obtained after a Read Range Activity, and assing the result into a variable?

Thanks in advance!

we can do (add by the understanding of value retrieval):
arrValues =
YourDataTableVar.AsEnumerable.Select(Function (x) x(YourColNameIrIndex).ToString).toArray

it will return us a string array and will work when the datatype of the data column is a simple datatype as string, int32, double…

About LINQ have a look here as well:

1 Like

Hello @dla - How about below expression

Variable of type double Output = DT.AsEnumerable.Sum(Function(x) Cdbl(x("Price")))
  • Replace DT with your data table name
  • Replace Price with your actual column name

Reference code - Example.zip (10.2 KB)

1 Like

Hi @dla ,

if you want to add column value plz check below workflow

ColumnValueAddToDataTable.xaml (10.1 KB)

Thanks,
Raj

Thank you a lot, it works!!

Thank you a lot!!

It`s also a soltion. I appologize I can only mark one answer as a solution.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.