How to know if I am in the first row of a data table?

Good night friends;

I’m going through a data table, I want to put an if conditional; the condition would be if the first line where the loop is.

I want to know if I’m on the first row

@Lynx

May I know the reason behind to check for First row here ?

@Lynx The loop always starts with the first line. So, you need not check whether you are in the first row or not

But, if you want to compare values then follow this

dt.Item(0).ToString.equals("0")

The above exp gives the current row value which is related to the first column

there is a set of actions that is only done for the first line, for the others only part of those actions will be executed (not all)

Hello @Lynx ,

Instead of for each loop, use For Each Row activity and in the property, assign a variable to index.
Inside the loop, use an if condition to check if IndexVariable=0

Thanks!
Athira

2 Likes

I get the message “item is not a member of system.data.datatable”

@Lynx The set of actions can only done for the first row and break the loop using Break activity

Please find attached workflow

Example.zip (3.1 KB)

1 Like

@Lynx Check this workflow and let us know if face any issues

like @athira.somasekharan said , just set a variable under index and check if index=0, then its the first row

1 Like

Thanks for answering, the problem is that the information is changing and I don’t know the data of the first cell

@Lynx Can you let me know what is the exact action that you want to perform in the first row of data table

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