How to use For Each in DataTable

Hi All,

I have read this using Read Range, Output as DT and now I want the Team Name (first column) wherever the value is greater than zero in Total column (Last column)


If you want to filter and get only greater than zero…use a filter datatable first and add the condition

And then use for each row in datatable activity

Or …you can as well use a if condition inside your for loop to seggreate greater than zero values

Currentrow("ColumnName").ToString will give the data of each column value for each row inside the for loop

Hope this helps


1 Like

I Tried with For each row in DT but getting the following error


Hi @Chetan_Wagh

Use filter datatable activity, pass the column name and set the value as 0

or use the below linq query

(From r In dtInput.AsEnumerable
Where CInt(r("Team Name").ToString().Trim()) > 0
Select d = r).CopyToDataTable


1 Like


Remove the inverted comma around zero… numbers dont need inverted comma

Cint(Row(3).ToString) > 0


1 Like

Hey @Chetan_Wagh ,


Thank you again for the quick help @Anil_G . :slight_smile:

1 Like

Can you describe the If condition.

LMK if this is correct. IF, Row(“ColumnIndex”)>0

Ohhh.Thanks a lot

1 Like


Please try this



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