Split Datatable with Fixed Number of Rows

Hi all!

I have a datatable with more than 90k rows (this number of rows will be changing depending on the inputs).

What I want is to split always with a max number of rows (always max of 40k rows):

For example, if I have 92k lines, generate 3 datatable.

  • Datatable 1 → Rows 0 to 39.999
  • Datatable 2 → Rows 40.000 to 79.999
  • Datatable 3 → Rows 80.000 to 92.000

Please, could you help me? I didn’t found something like that.

Thanks in advance,

@nestor.zarallo
welcome to the forum

find starter help here:
DTSlice_BySegmentSize_ToTableList.xaml (10.5 KB)

UPDATE:
When working within a Project with set ProjectCompatibility to Windows we can do:
Assign Activity:
TableList | List(of DataTable) =

dtData.AsEnumerable.Chunk(intChunkSizeVar).Select(Function (x) x.CopyToDataTable).ToList

intChunkSizeVar | int32 = 40000

2 Likes

@ppr

Thank you so much for your fast answer.

I can apply your example to my project!

Best regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.