How to iterate over Columns and only one row

Hii,

I Have a range of columns on which i wanted to iteration.
Also i have a row index on which i want to iterate my coumns.

But my issue is I dont know how to loop on one row and all columns.

Means ,Suppose at row 16 i want to iterate on evry column.

so how do i write logic for this.

please help

Hi @Doonline

Have a view on the thread below!

Regards

No thats not my requirement

Hi!

if you want only one row you can simple use get row item

Regards,
NaNi

I dont want row.
I have it.
only on that row i want to iterate my column

Hi @Doonline

Suppose we are assuming that creating the index variable in for each row

You need to iterate over column means

Currentrow(idx).tostring will give the result as per row index!

Regards

Hi!

In that case try like this

DataTable.Columns(Index).ColumnName

Regards,
NaNi

This will give me the index of column

heres an example:
e.g. you have a datatable called “dt” then you assign the 16th row to a DataRow variable called “row16”

  • you can use a foreach loop, where typeArgument = “DataColumn” and values = “dt.Columns”, to loop over all the columns of that datatable,
  • to loop over the columns of “row16”, just do row16(item.ColumnName).toString on each iteration

    When i run this sequence you can see that it only prints out the column values for that particular row
    image

Sequence.xaml (10.6 KB)

@Doonline ,

You can use For each row and while loop to loop through all columns of a particular row.

First, we can get the column count of datatable.
Then, use for each row & while activity. For this purpose, I have just used a log message.

image

image

Hope this helps. Happy Automation!!!

iterating over all column values of a particular row we can use the itemArray of that row

YourDt.Rows(YourIndex).ItemArray - an Object array each item representing the particular column value

grafik