Auto-increment an index serial number column in datatable from '1' not '0'

Hi there - could someone help with this auto-increment datatable issue I’m having please? It seems to be alluded to in other threads but I can’t find any conclusive solutions.

I have a datatable to which I’m adding rows for each iteration of a loop with an index/serial number column which I want to increment by 1 for each new row, beginning with ‘1’ for the first row. I’ve configured the Add Column activity to ‘Auto-increment’, but the first row in new datatable is being numbered ‘0’.

This is how the index Add Data Column is configured:

And this is how the Add Data Row is trying to populate the column on each iteration of the loop:

But this is what it produces each time I run it:

Auto%20increment%20column%20from%200

Any help you can give in resolving this would be very very appreciated indeed.

Thanks very much - best wishes

Akan

@AkanL

Instead of using Auto increment feature, you can achieve this same by doing little programming.

Use a counter variable and initialise with 1 by default. Inside for each loop, in add data row activity, put counter as first value in place of Nothing. Just before the end of for each loop, increment counter by +1. This way you’ll able to get your id starting from 1.

Let me know incase of query.

@singhonkar, that has worked! Thank you so much - that’s really helped me move on with this automation - thanks for taking the time to suggest this - much appreciated!

1 Like

@AkanL Welcome

@AkanL

If the above solution is working for you then please mark it as solution. This will help to others and save their time.

oh yes, sorry - I forgot that was an option - done - thanks very much!

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