Hi,
I want to add the received quantity, if the invoice number is same, please refer to
input sheet : input.xlsx.
Required out put : output.xlsx
please help.
Input.xlsx (10.2 KB)
Output.xlsx (9.9 KB)
Hi,
I want to add the received quantity, if the invoice number is same, please refer to
input sheet : input.xlsx.
Required out put : output.xlsx
please help.
Input.xlsx (10.2 KB)
Output.xlsx (9.9 KB)
We can do it with the help of a group by
A LINQ approach could start by:
Assign activity:
LHS: dtResult | Datatype: DataTable
RHS: dtData.Clone - dtData is your DataTableVar
Assign Activity
LHS: dtResult
RHS
(From d in dtData.AsEnumerable
Group d by k=d("Material ID").toString.Trim into grp=Group
let s = grp.Sum(Function (x) CDbl(x("RECEIVED QUANTITY").toString.Trim))
let ra = new Object(){grp.First()(0),grp.First()(1),s,grp.First()(3),grp.First()(4)}
Select r=dtResult.Rows.Add(ra)).CopyToDataTable
It can be the case that the CDbl /Double Conversion is to adopt /to finetune. Also, depending on the dataquality some data cleansing can enhance the process