hi please anyone help me explain this code if its going to help me achieve what I want
my = (From d In dt.AsEnumerable Group d By k1=d(“SenderName”).ToString.Trim.Replace(" “,String.Empty), k2=d(“BeneficiaryName”).toString.Trim.Replace(” “,String.Empty), k3=d(“BankName”).toString.Trim.Replace(” “,String.Empty), k4=d(“BeneficiaryAccountNumber”).toString.Trim.Replace(” “,String.Empty), k5=d(“SenderAccountNumber”).toString.Trim.Replace(” “,String.Empty) Into grp=Group Let s = grp.Sum(Function (x) CDbl(x(“TransactionAmount”).toString.Trim.Replace(” ",String.Empty))) Let ra = New Object(){k1,k2,K3,K4,K5,s,grp.First()(3)} Select my.Rows.Add(ra)).CopyToDataTable
Hi, Thank You very much . what I posted actually works . Eevrything is okay now , I would have deleted this thread but I will leave it here because it might help someone in future
my = (From d In dt.AsEnumerable Group d By k1=d(“SenderName”).ToString.Trim.Replace(" “,String.Empty), k2=d(“BeneficiaryName”).toString.Trim.Replace(” “,String.Empty), k3=d(“BankName”).toString.Trim.Replace(” “,String.Empty), k4=d(“BeneficiaryAccountNumber”).toString.Trim.Replace(” “,String.Empty), k5=d(“SenderAccountNumber”).toString.Trim.Replace(” “,String.Empty) Into grp=Group Let s = grp.Sum(Function (x) CDbl(x(“TransactionAmount”).toString.Trim.Replace(” ",String.Empty))) Let ra = New Object(){k1,k2,K3,K4,K5,s,grp.First()(3)} Select my.Rows.Add(ra)).CopyToDataTable
mydt should have been initialized with the expected columns