arcgis字段计算器
一、VB脚本
1、取某字段前几位或者后几位
Left(字段名称,6) Right(字段名称,6)
2、合并字段,中间加符号
Dim a if [ZDDM2] ="" Then a= [ZDDM1] else a= [ZDDM1] + "/" + [ZDDM2] end if
3、ifelse判断
dim u if [OBJECTID] =1 then u="a" elseif [OBJECTID] =2 then u="b" end if
注意:不管有多少个if,只要写一个end if 就行。
4、统一赋值

5、模糊查询
ZDDM LIKE'%JC%'
二、Python脚本
1、字符串+年月日+自增补齐
rec=0 #无空格 def autoIncrement():#无空格,定义方法名 global rec#一个空格 pStart=1 #一个空格,初始值,可以调整 pInterval=1 #一个空格,自增间隔,可以调整 if(rec==0): #一个空格 rec=pStart #两个空格 else: #一个空格 rec=rec+pInterval #两个空格 return "TD"+datetime.datetime.now().strftime('%Y%m%d') + '%08d' % rec#一个空格 ,字符串+时间+自增补齐