I have a process in which my input excel is like the one I attached (inputExcel), it has 9 columns. One of the columns is “Deliveries”, this field can contain 1000 or more elements (delivery) separated by ;. I need, when there are more than 200 in this field, to divide it, keeping all the data from the rest of the fields in blocks of 200. I attach an example of the ResultExcel output excel. Thanks for the help.
inputExcel.xlsx (8.7 KB)
Result_Excel.xlsx (9.0 KB)
We guess that we already had answered here:
it is maybe only a variation on the structure which has to be incorporated:
(From d In dtOrigin.AsEnumerable
Let ars = d("Deliveries").toString.Trim.Split(";"c)
Let sgc = CInt(Math.Ceiling(ars.Length / 200))
From sgm In Enumerable.Range(0,sgc).Select(Function (c) ars.Skip(c*200).Take(200) )
Let ra1 = d.ItemArray.Take(4).Append(String.Join(";",sgm))
Let ra2 = d.ItemArray.Skip(5)
Let ra = ra1.Concat(ra2).Cast(Of Object).ToArray
Select r = dtResult.Rows.Add(ra)).CopyToDataTable
1 Like
Thank you very much for your help, really.
It works perfectly, and I think this time I understood the logic.
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.