2

So I can use the @row_number function to number sequentially but I want my start value to be 27, not 1. Is there some bit of code i need to use, where I can change the start value?

basto
  • 162
  • 11
Robin L
  • 41
  • 1
  • 6

2 Answers2

9

To increase the starting value of a variable, use addition.

@row_number + 26

enter image description here

csk
  • 24,827
  • 3
  • 32
  • 70
0

You can do this with python parser

rec=0  
def autoIncrement():  
 global rec  
 pStart = 1 #adjust start value, if req'd   
 pInterval = 1 #adjust interval value, if req'd  
 if (rec == 0):   
  rec = pStart   
 else:   
  rec = rec + pInterval   
 return rec  

Then type the name of the function into the textbox below the code block:

autoIncrement()  

Source: https://support.esri.com/en/technical-article/000011137

NULL.Dude
  • 2,131
  • 2
  • 14
  • 32
  • This appears to be for ArcGIS rather than the requested QGIS. Also, it is always good (and expected) to credit those that you copied and pasted their code: e.g. https://support.esri.com/en/technical-article/000011137. – Aaron Mar 28 '18 at 19:29