Hi All
is their a way to get the total of a row as shown below
way to get the total as a Var
Thank you
Please follow the below steps,
- Read the excel.
- Drop ‘For Each Row’ activity and provide datatable variable.
- Inside ‘For Each Row’ assign the int variable and give value like this,
Convert.ToInt32(row(YourColumnName).ToString)+Convert.ToInt32(row(YourColumnName).ToString)+Convert.ToInt32(row(YourColumnName).ToString)+Convert.ToInt32(row(YourColumnName).ToString)
Attached workflow for your reference,
Feel free to reach us at any time if you have doubts. Thanks.
Happy Automation
@Tharusha_Fernando
give a try on following
prepare a result datatable e.g. dtResult = dtOrigVar.Clone
Add a column Total to dtResult with add datacolumn activity
use an assign activity:
left side: dtResult
right side:
(From d in dtOrigVar.AsEnumerable
Let t = {"car loan","housing loan","food", "transport"}.Sum(Function (x) Convert.ToInt32("0" & d(x).toString.Trim))
Let ra = d.ItemArray.Append(t).toArray
Select dtResult.Rows.Add(ra)).CopyToDataTable
Thank for commenting
i have around 30 Column so i cannot write all the column name is their any way to mention the Range of the columns that i want to add
This is the look of my DataTable
B4:AE15
lets assume you want to sum up all columns:
Let t = d.ItemArray.Sum(Function (x) Convert.ToInt32(“0” & x.toString.Trim))
Lets assume you want to sum up not all columns but all with the name 1,2,3…30
Let t = Enumerable.Range(1,30).Sum(Function (x) Convert.ToInt32("0" & d(x.toString).toString.Trim))
it is like a parameter and represents the current item on which is worked
it worked thank you
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.