For Each row in data table - rowcount

Hi,

I have two rows in my datatable, and when I am using for each row in data table, it is processing properly for 2 rows but then it enters for 3rd row as well and then gives Error at the end where it could not find anything to assign to my variable. Why my process doesn’t end after completing process of 2 rows.

Please suggest
Thanks

@sgarg

check whether your datatale contains how many row before to for each row in datatable activity

datatable.rows.count

1 Like

@sgarg

may be there is a blank row please check the same

cheers

Hi @sgarg ,

We would assume there are spaces in the rows and hence the Robot is also picking it up and processing it.

Methods to Solve :

  1. Source issue : Source Data file can be corrected as the control is within the user’s or developers end. (Manual correction)

  2. Filtering out the Empty spaced rows present using a Linq/Filter Datatable and get the Filtered Datatable, could refer many posts on this available also the below could be used :

dt = dt.AsEnumerable.Where(Function(r)Not r.ItemArray.All(Function(x)String.IsNullOrWhitespace(x.ToString))).CopyToDataTable

Let us know if the methods suggested helped in solving the issue, else we would ask you also perform Debugging and Validate from Immediate Panels (Self Check and learning)

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