How to loop per 20 rows in a data table?

Hi UiPath,

I need help with my situation.

Let say I have the dataset below:

and I need to paste it in a web application that only accept maximum of 20 entries per transaction.

as you can see I have 23 entries. I want to paste all of it using for loop.

I know I can do it using the for loop. but how can I formulate the logic for that?

is there an easy way to achieve this outcome?

thanks!

Hi @alvin.c.apostol26

  1. Use Read range activity Store it as DtRead
  2. Use for each row in DataTable activity

Regards
Gokul

image

Hi @alvin.c.apostol26

since its in a loop

lets say for each row in DT

put a if condition

image

hope this helps

Hello @alvin.c.apostol26 ,

You can pick only 20 records per transaction by using the below logic :
Initially initialize counter to 0

dt_Output = dt_Input.AsEnumerable().Skip(Counter_value).Take(counter_value+20).CopyToDataTable()

after the expression initialize counter to :
Counter_Value = Counter_value+(dt_Output.Rows.Count)

Thanks,
Rohith

1 Like

in for each row activity there will be the property name called maximum iteration, there you can mention 20 or as your need

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