How to get row number or iteration number in a For Each Row activity in StudioX?

Is there a way I can either see the row # I am at or count the number of iterations I am on in StudioX? I would just like to use an assign variable and increase it by 1 at each iteration, but I don’t think you can use variables in StudioX.

Without a variable, my thought was to get current row’s row number, but I can’t figure out how to do this.

Hi @bot82 …You can use “Save for Later” and introduce a counter…

Please find the starter help here…

Here : Left Hand side == >Counter = Saved.Values(Of Integer)(“Counter”)

Right hand side = Counter + 1 => Saved.Values(Of Integer)(“Counter”)+1

Write Line: Saved.Values(Of Integer)(“Counter”).ToString

My output:

So excluding the header, my file has 16 rows…and the output is capturing the count perfectly.

Note: You don’t have to type Saved.Values(Of Integer)("Counter") everytime, once you saved the value as integer first time, then you can easily use the + button and add it.

Hope this helps…

There is also a CurrentIndex option in the dropdown menu. See bellow:

1 Like

Hello, do you know if this option is available in StudioX? I tried this for a few different For Each Excel loops, but I don’t see the “Current Index” option.

Hello, thanks for this reply. Do you know if this “Save For Later” activity is available in StudioX? I searched for the activity, but can’t find it.

@bot82 - might be available in the updated package.

Please go to manage packages and check for blue arrow on the system packages…if avaiable, please update and check…

Thanks for the idea, I did update my packages, but unfortunately it is still not available

@bot82 - Please check this doc…

https://docs.uipath.com/activities/docs/assign-preview

1 Like

THANK U