kimtheis@yahoo.com

AddField for multiple fields in one table

Discussion created by kimtheis@yahoo.com on Aug 9, 2013
Latest reply on Aug 12, 2013 by Caleb1987
Hi,
Im a newbie....Ugh

I am trying to use the AddField function to add a bunch of fields to one attribute table. I can get my script to work for ONE field. But I want it to work for Many fields....I have to stop working on this project by 10pm tonight so if you have help, dont be shy!

Here is my script: (I took it from the Help section :)

# Name: AddField_Example2.py
# Description: Add a pair of new fields to a table
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:\Users\Kim\Documents\Lava_Beds_GIS\labe_geology.gdb"

# Set local variables
inFeatures = "labeglg"
fieldName1 = "Parking"
fieldPrecision = 10
fieldName2 = "COMM_SUPP"
fieldLength = 10
fieldName3 = "Trails"
fieldPrecision = 10
fieldName4 = "HANDI_ACC"
fieldLength = 10
fieldName5 = "COMM_SUPP"
fieldLength = 10
fieldName6 = "SIGNAGE"
fieldPrecision = 10
fieldName7 = "ACCSBLE"
fieldLength = 10
fieldName8 = "LEV_DIFF"
fieldPrecision = 10
fieldName9 = "WEB_PAGE"
fieldLength = 10
fieldName10 = "WEB_MAP_AC"
fieldPrecision = 10
fieldName11 = "PREWEB_UTL"
fieldLength = 10
fieldName12 = "FAC_TRST"
fieldPrecision = 10


# Execute AddField for new fields
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "")

Outcomes