Sum column in collection - C# code stage *SOLVED*

KWH

New Member
*Solved*.........


Hi

I'm looking to summarize all values in a specified column in a collection through a code stage (not looping).

In this collection called "Collection", I want a sum of all values in column "Numbers".
1612435555473.png

I don't read or write C# very well, so can someone provide a code that will work for this?
I tried to use the compute method, with no luck (MSDN)

Code:
private void ComputeBySalesSalesID(DataSet dataSet)

{

    DataTable table;

    table = dataSet.Tables["Collection"];



    object sumObject;

    sumObject = table.Compute("Sum(Numbers)", "");

}
Thanks a lot!
 
Last edited:

Pete_L

Active Member
You have marked this a Solved. Can you please provide the code that worked for you?
Thank you.
 
Top