Split the output data table into smaller data table which contain 50 rows per data table

Hi,

  • Read excel input contain more than 500 rows
  • Split the output data table into smaller data table which contain 50 rows per data table.
  • Log message for each small data table row count

How to approach this one? I am not finding any Good logic to do it. Please put some hints or share xaml file.

Hello @Ritesh_Burman

One approach is as below:
1)excel scope
2)use find first/last row to get the last row number
3) use assign and then use the last row number %50 to get the number of small sets(50 rows) ( sectionVar)
4)use while loop (i<=sectionVar)
5) Read range to get output in data table variable( range need to be dynamic by passing x+50 ( where x is an integer variable declared as zero)

I think this should work for you…So range will get increase as 50,100,150 like that

A0:B50, A50:B100 etc

In Additiona to above find a compacted variation:

Assign Activity:
SegmentSize | Int32 = 50

Assign Activity:
NoOfSegments | Int32 = Convert.ToInt32(Math.Ceiling(dtData.Rows.Count / SegmentSize))

Assign Activity:
TableList | List(Of DataTable) =

Enumerable.Range(0,NoOfSegments).Select(Function (x) dtData.AsEnumerable.Skip(x*SegmentSize).Take(SegmentSize).CopyToDataTable).ToList()

For each Activity: item in TableList | TypeArgument: DataTable

  • Log Message: item.Rows.Count.ToString()
1 Like

You can modify the XAML from the Links shared above

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