My excel sheet looks like this since I can’t upload it.
Item Number
Chicken 2
Ham 5
Fish 3
Sheet1 Sheet2 Sheet3
…
I already did the excel application scope and read range all 3 sheets and put in DataTable1/2/3 respectively. How do I sum for example ham across all 3sheets? I tried using For each row and it doesn’t work. After summing out the number of fish, I will then put the total sum of fish into a google form which I know how to do. And also what variable type I need to do cause I keep messing up between string and integer.
After reading the datatable, u can merge the datatables into single one using Merge DataTable activity and store the result in resultant datatable , let’ say dt_result
To get the sum of particular Item, u can try this assign activity [ below example is for taking the sum of item Ham.
Hi, thanks for your reply. i don’t understand item_sum = dt_result.AsEnumerable().Where(Function(row) row(“Item”).ToString.Equals(“Ham”)).Sum(Function(row) CInt(row(“Number”).ToString)).ToString
Is there anyways for me to sum every single item in another easier method? If i want to put in trycatch into my program,for eg, when there is no number beside my item, there will be a message box show warning and also stop the program.
Hi @cxx
yes there is simple way to do it, but linq query will helps to do your thing much faster than normal way of doing
for doing normal way:
after reading the excel file and storing in datatable, use filter datatable activity to filter the Item Column based on value u want to filter.Then store the output in dt3 datatable variable
Now use assign activity to intialize a int32 variable sum_data =0
now use for each row to loop through each row in dt3,
inisde that use assign activity