Column loop +1

Hi!

In a loop, how can I move on to the next column? I have the variable row(6).ToString and i wanto to i want to pass to row(7).ToString… row(8).ToString :slight_smile: tanks for this “basic” question :slight_smile:

@Pedro_Santos
in general looping over Columns of a row can be done

  • via index lists
  • in combination of the YourRowVar.ItemArray and the methods Skip and Take

for sure the for each activity is helping us
retrieving some information e.g. the Count of Columns DataTable.Columns …(e.g. Count) is helping

mybe you break down the requiremtents more down, so we can be more specific on a solution approach

1 Like

If you want to write all the values for the columns you could do:
For Each Row
For Each column In row.Table.Columns
row(column.ColumnName).ToString

in fact what I need is this: inside a for each row, I need a loop / counter that looks from column G onwards, if it is filled and if it is, I need to copy the contents of the cell. So I don’t intend to copy them all … they’re not all filled out.

something like that…a while maybe?

Tanks!
prints below:

If you have a fixed number of columns then you should use While loop and create before it a variable to use as a counter:
varTotalColumnsAfterG = 10
While varTotalColumnsAfterG > 0
. Do your thing .
. varTotalColumnsAfterG = varTotalColumnsAfterG -1
End While

@Pedro_Santos
find some demo xaml here:
DT_Iteration_AllCols_PartialCols.xaml (11.6 KB)

2 Likes

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