jenabbott

Referencing attributes in a script

Discussion created by jenabbott on Oct 17, 2013
Latest reply on Oct 24, 2013 by thanos_cp78
Good morning,

I am trying to automate my map so that every time I make a new map the property number changes according to the attribute table. I have figured out how to do this (thanks to this forum), but I can only make it happen with one shapefile. The dataset I'm working out of has many shapefiles which I need to reference some of these. My script is as follows;

import arcpy
mxd=arcpy.mapping.MapDocument("Current")
lyr=arcpy.mapping.ListLayers(mxd,"ECLS")[0]
elemlist=arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENTS","Sub Title")[0]
rows=arcpy.SearchCursor(lyr.dataSource)
row=rows.next()
elemlist.text="Recreational Lease" + "\n" + "Property No:" + row.getValue("PROPERTY")

I know it has something to do with the [0] as the object being referenced, but I'm not sure how to reference other items in the attribute table? I've tried creating a list, but that doesn't seem to be working....Can someone please help me???

Outcomes