I would like to loop a data table and pick only rows which are in the iteration of 10 like row no#10, 20,30 etc till the end of total rows?
@raja.mahajan
welcome to the forum
give a try on following:
for each activity - item - Typeargument: DataRow - Values: YourDataTableVar.AsEnumerable.Where(Function (x, i) i Mod 10 = 0).Skip(1)
Statement will return 10, 20…th row and send it to processing implemented inside the for each body
Thanks you for your reply, Can you tell me where should i be putting the function you mentioned?
on the field right to in
Do I need to change the variable type instead of data table?
Can you try with below approach? it’s simple one and works as well.
boolLessThanTen = True
totalRow = dt.rows.count
while totalRow >=10 and boolLessThanTen {
if totalRow >=10 {
read file from A1:A10
delete first 10 rows,
after deletion, remaining rows 30 out of 40, 10 is already deleted.
}else{
write rows which are less than 10 or do what u wanna.
set a flag false or true.
boolLessThanTen = False
}
}
while loop will keep on running until and unless rows become less than 10 and boolean variable is marked as false.
give a try… it followed this approach for my requirement of 20000.
Cheers,
Pankaj
Thanks you, it worked
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.