Break loop by 2000 records, perform other operations and continue loop

Hello Devs, please assist, I need to pick every 2000 records for each row, perform operation and pickc another 2000 till the records are completed.Pls assist

There is an index variable for for each activity, use the value of index and check if its multiple of 2000, if yes, do ur operations

Try this workflow.
in this work flow you just loop and check if the main data table you have if greater than 0
assign a temporary datatable with first N rows dt_Main.AsEnumerable.Take(NumOfRows).CopyToDataTable()

Next you remove N number of rows from your main datatable
if(dt_Main.RowCount>NumOfRows,dt_Main.AsEnumerable.Skip(NumOfRows).CopyToDataTable(),dt_Main.Clone)

Testing2000RecordLoop.xaml (10.0 KB)

1 Like

HI @RPA-botDev,

You can use kind of below logic for this

For-each(file in fileList) out index
{
    //Your Logic

    If(index+1 mod 2000 == 0 OrElse index+1 = fileList.Length)
    {
        //Write output file
    }
    Else
    {
        //Continue
    }
}

Thanks

1 Like

Alright, I’ll try it out here

Thanks Vidu_Senanayake

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