I need some help for Linq Code ; I want to do that mutible group by sum of column. So I have three columns and 10.000+ rows. I must group same rows and sum. I have below Linq codes;
GnlEnumDT => (From M In DT.AsEnumerable()
Group M By M_No = New With { key.MusteriNo = M.item(0), key.MusteriAdi = M.item(1) }
Into MGroup = Group Select New With { M_No.MusteriNo, M_No.MusteriAdi, .Toplam=MGroup.Sum(Function( x ) Double.Parse((x.Item(2).ToString.Replace(“.”,“”)).ToString.Replace(“,”,“.”)))}).toList
When I try it I am gettin an error at StrResult_ assign. “Assign: Index was outside the bounds of the array.” How can I run it within array boundaries. do you have any idea?
It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.
First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.
You can check out some of our resources directly, see below:
Always search first. It is the best way to quickly find your answer. Check out the icon for that.
Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.
Topic that contains most common solutions with example project files can be found here.
Read our official documentation where you can find a lot of information and instructions about each of our products:
Meet us and our users on our Community Slack and ask your question there.
Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.
Thank you for helping us build our UiPath Community!
Hi @mhmmtsdkmrt,
Sorry for general answer but I don’t exactly have idea what you are trying to do with these Linq queries. Usually outside boundaries errors occurs when during looping though all elements in array you will go to far. Please remember that indexing is always starting from 0 not from 1. So maybe adding somewhere in your query a “-1” will help? Just guessing.
Of course Dear Pawel. Actually I used different a LinQ Codes for my new solution but I think there is error because of header for my old codes. Anyway…
As I say, I have a data table. it has three colums and 10.000+ rows. I needed group same rows and sum on this data table.
Firtsly,
My DataTable name is FirstGeneralDT and I used a list. List name is ListA (string of List)
GeneralDT = (From M In FirstGeneralDT.Select() Group M by MusteriNo=M.Item(“Column1”).ToString into Group Select Group(0)).toArray.Copytodatatable()
ListA = (From M In FirstGeneralDT.Select()
Group M By MusteriNo=M.Item(“Column1”).ToString, MusteriAdi=M.Item(“Column2”).ToString Into GroupA=Group
Select Convert.ToString(GroupA.Sum(Function(x) Double.Parse(x.Item(“Column3”).ToString.Replace(“.”,“”).Replace(“,”,“.”))))).ToList()