添加字段
进行字段计算(可以选中部分来计算)
重要提示:解析程序一定要选
Python
,并将“显示代码块”勾选!代码块
- 预逻辑脚本代码:
base=0
def autoIncrement():
global base
pStart = 1 #初始值
pInterval = 1 #间隔值
if (base == 0):
base = pStart
else:
base = base + pInterval
return base
- 函数调用
实现常规编号
autoIncrement()
实现给定长度编号,5为长度是5,如00001
(str(autoIncrement())).zfill(5)
实现从某个数字开始编号,下为从1000开始编号
autoIncrement()+1000
如果你想给编号前加上字母,比如加上
BH
,请将return base
修改为return "BH"+str(base)
即可。