Phil_Wu
(Phil Wu)
December 13, 2017, 7:48am
1
Hi Guys,
I am facing a trouble that:1
String values can’t be summarized due to datatype issues;
If I did convert the column of String values into int32, then I couldn’t sumup the numeric values unfortunately.
So can anyone help take a look at my flowchart, and tell me where I made mistakes?
Thanks a lot!
datatble col sumup Phil.xaml (12.1 KB)
ddpadil
(Dilip)
December 13, 2017, 10:13am
2
Hello there,
You do have an option while building datatable ,it would’ve been easier if you change your data type to int while building.
Convert.ToInt32(dtAllRows.Compute(“Sum(Cost)”,String.Empty))
However if its already in string type you could try this out:
dtAllRows.AsEnumerable().Sum(x =>Convert.ToInt32(x[“Cost”]))
For the reference:
datatble col sumup Phil.xaml (16.9 KB)
1 Like
balupad14
(Balamurugan)
May 23, 2018, 12:38pm
4
Hi @Phil_Wu ,
A single activity will do the convert the type and do the sump. Check it below.
Hi Friends.
I have included some activities in the package of BalaReva.Datatable.Activities
You can see in the below namespace
[image]
The key advantages are below
1.ConvertInputColumn - When you read the data from excel , it is always string format. Using this property can able change the data type and do the aggregation .
2.NullValue - If you have empty of null value in the data. can able to assign the default value for it.
3.Select- It is place to keep the condition(Where)
Sample Fil…
Regards
Balamurugan
suresh_s
(Suresh S)
September 18, 2018, 4:38pm
5
Hi
I tried below method, also with your attached xmal there is error , how did u solve this.
can you please to resolve
**dtAllRows.AsEnumerable().Sum(x =>Convert.ToInt32(x[“Cost”]))