1、Arcgis计算数值型字段的累加值
Parser:Python
Code Block:
total = 0
def accumulate(increment):
global total
if total:
total += increment
else:
total = increment
return total
Expression:
accumulate(!FieldA!)
2、根据某间隔值计算顺序 ID 或数字。
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
autoIncrement()