Hi all,
I'm using ArcGIS 10.0 (ArcInfo level). Below is a script that creates an empty list, loops thru a parcels feature class, gets the value for each record in the 'APN_NU_1' field and populates the list with the values. This runs perfectly. How do I write this script to populate the list with multiple fields and their values, say 'APN_NU_1', 'ADDR_B', and 'CITY'? I will then be using this list to call for further programming..
Thanks for any immediate feedback,
Christi
I'm using ArcGIS 10.0 (ArcInfo level). Below is a script that creates an empty list, loops thru a parcels feature class, gets the value for each record in the 'APN_NU_1' field and populates the list with the values. This runs perfectly. How do I write this script to populate the list with multiple fields and their values, say 'APN_NU_1', 'ADDR_B', and 'CITY'? I will then be using this list to call for further programming..
Code:
import modules and define workspace
import arcpy
import os
import traceback
workspace = arcpy.env.workspace = "E:/dev/Christi/PSL/"
arcpy.env.overwriteOutput = True
#Define map document
mxDoc = arcpy.mapping.MapDocument("CURRENT")
#List the first dataframe (named Layers) in the map document
df = arcpy.mapping.ListDataFrames(mxDoc, "Layers") [0]
#List first map layer (which is the parcels layer) in dataframe
parcelLayer = arcpy.mapping.ListLayers(mxDoc,"",df) [0]
#Select parcel layer by attribute and clear any previously selected features
#Set up a Search Cursor to go thru the attribute table and get row values
#Set up variable, then read the row values for 'APN_NU_1' field and populate the list
arcpy.SelectLayerByAttribute_management(parcelLayer,"CLEAR_SELECTION")
rows = arcpy.SearchCursor(parcelLayer)
stringList = []
for row in rows:
stringList.append(row.getValue('APN_NU_1'))Christi