Using the Field Calculator to execute a Python codeblock to calculate sequential numbers on a selected set of features in a geodatabase feature class only calculates sequential values in groups of 250 features. After each group of 250 features the sequential numbering starts over again.
上次发布: August 25, 2014ArcGIS for Desktop
漏洞 ID 编号
NIM064043
已提交
January 10, 2011
上次修改时间
June 5, 2024
适用范围
ArcGIS for Desktop
找到的版本
10.0
操作系统
Windows OS
操作系统版本
XP
修正版本
10.1
状态
Fixed
此漏洞已得到修复。 有关详细信息,请参阅“版本修复”和“其他信息”(如果适用)。
解决办法
Use python window and update cursor in a script similar to the following:import arcpydef 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 += pInterval return rec# ################################# ################################ ## ## Attention User!!! Please Specify Feature for Calculation below.. ## ## ################################# ################################ #inFeatures = "Dallas_poles" # Specify feature to use for calculations# Add AutoInc fieldtry: arcpy.AddField_management(inFeatures, "AutoInc", "LONG", "", "", "", "", "NULLABLE")except: arcpy.GetMessages(2)# Create UpdateCursor Objectrows = arcpy.UpdateCursor(inFeatures)rec=0 # Declare rec variablefor row in rows: autoIncrement() # Perform autoIncrement() module row.AutoInc = rec # Set current row equal to rec rows.updateRow(row) # Update the row to reflect the changedel row, rows # Delete cursor and row objects to remove locks on the data