Recordcounter + Record length

I have a datamepper who writes data into the same table in 2 repeat steps.
I have added a RecordIndex to the table by using:
steps.currentLoopCounter;

First repeat writes the RecordIndex correct 1,2,3 etc,
The second of cause starts from 1 again.
How do I set the recordIndex to the current record number, instead of using setps.currentloopcounter.
So the second repeat in this case starts from 4 ?

image

I t

Define a record property named lastValue in your pre-processor step and initialize it to 0.
In your loops, increment its value by 1 and extract that value instead of using the currentLoopCounter property.

Solved it with this one:
var lastValue= parseInt(sourceRecord.properties.lastValue);
lastValue+= 1;
sourceRecord.properties.Ass_Index = lastValue;

And then setting it to integer.

This works fine for me:

var lastValue = sourceRecord.properties.lastValue;
sourceRecord.properties.lastValue += 1;
lastValue;