步驟1:於TABLE表內新增一欄位「Count」,選擇Short Integer格式
Step 1:Create a type " short integer" new field named “Count”.
步驟2:於「Count」欄位,利用FIELD CALCULATOR計算建立流水號
Step 2:Select the “Count” column, use the tool “field calculator” to populate sequential numbers.
步驟3:Parser 選擇「Python」,將「Show Codeblock」打勾,並將程式碼貼入下列兩個方框
Step 3:Set the Parser to “Python”, check the check box for “Show Codeblock”, paste the following code into the “Pre-Logic Script Code” and the smaller box below the “Pre-Logic Script Code”.
Pre-Logic Script Code_1
1
2
3
4
5
6
7
8
9
10 rec=0
def autoIncrement():
global rec
pStart = 1
pInterval = 1
if (rec == 0):
rec = pStart
else:
rec += pInterval
return recPre-Logic Script Code_2
1 autoIncrement()
How to Create Sequential number in a field using Python in the Field Calculator?