How Split the datatable in rows

Hi All , I have a datatable and during my processing i want to split the datatable in 4 rows each and perform some actions on those four rows after completing the four next fours i need to pick and perform some action . how can i achieve this can anyone please help me

Hi @vishal_nachankar ,

Refer to the following thread to know about splitting the data table based on number of rows:

Regards,

Hi @vishal_nachankar

You can use the following query to split the data table into chunks of 4 data rows and process accordingly:

Dim chunks = From i In Enumerable.Range(0, dataTable.Rows.Count)
             Group dataTable.Rows(i) By chunkIndex = i \ 4 Into chunk = Group
             Select chunk.CopyToDataTable()

You can then loop through the chunks collection and perform your desired actions on each data table.

Hope this helps,
Best Regards.

2 Likes

actually the four rows which i get right i will use them as a single string… so what is the output type of chunks?

@vishal_nachankar

The output type of chunks is IEnumerable(Of DataTable) , which is a collection of DataTable objects. If you want the chunks in a single string, you can use Output Data Table activity for the same.

Hope this helps,
Best Regards.

Let me try this

Getting error

Getting Error

@vishal_nachankar

Please try this. It is exactly same with different chunk size

cheers

1 Like

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