Hi everybody,
Im trying to create a new field which will start with the value 1201 and increment by 1 until the end (82 values).
I have tried to use the code block to make it create such field but couldn't make it..
help please? Tnx
Solved! Go to Solution.
You could use itertools.count
Expression:
next(counter)
Code block:
import itertools
counter = itertools.count(start=1201)
Please create new field with "Double"
Value
raka()
Code Block
rec=0
def raka():
global rec
pStart = 1201
pInterval = 1
if (rec == 0):
rec = pStart
else:
rec += pInterval
return rec
You could use itertools.count
Expression:
next(counter)
Code block:
import itertools
counter = itertools.count(start=1201)
cheers!
short and elegant. Do you recommend to study the itertools ?
Please create new field with "Double"
Value
raka()
Code Block
rec=0
def raka():
global rec
pStart = 1201
pInterval = 1
if (rec == 0):
rec = pStart
else:
rec += pInterval
return rec
!!!!!!!!!!!!! 🙂