For each row in column

I want to use for each row in a column i want to use increment
Eg:
ID1:
ID2:
ID3: …

How do i achieve this ?

HI @RACHEL_PAUL

  1. Use Assign activity
Count = 1
  1. Use Read Range activity → Store it as DtRead

  2. Use For each row activity

Inside the for each row

  1. Use Assign activity
Variable = "ID"+Cdbl(Count).ToString
  1. Use Assign activity
Count = Count+1

Regards
Gokul

for each row activity has an output index:
grafik

this can be used ootb (it is 0 based) like
“ID” & (indexOutVar + 1).toString

Hi @RACHEL_PAUL

Check out the XAML file

IncrementCountForEcah.xaml (8.9 KB)

image

Regards
Gokul

You’re making extra work for yourself. You don’t need the Count variable. That’s what the index property of the For Each Row in Data Table activity does. Get rid of the Count variable and the two Assigns for Count. Go to For Each Row in Data Table, put the cursor into the index property, press CTRL+K and type Count. Change your OutVal assign to “ID” + (Count + 1).ToString

The +1 is because it’s a 0 based index, so the first row would be ID0 without (Count + 1)

How do i write it for a particular coulmn ?

HI @RACHEL_PAUL

Inside the for each row activity

Use Assign activity

Currentrow(“Column name”) = “YourValue”

image

Outside the For each row Use write range activity

Or

You can try with Add Data Row activity

Regards
Gokul

Not sure what you mean.

Got the ouptut.
Thanks alot!

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