AnsweredAssumed Answered

How to use Update Cursor to Update Info in Empty field?

Question asked by fumani on Aug 19, 2015
Latest reply on Aug 19, 2015 by iamurray

I have a shapefile for hospitals and in the attribute table I added a  new field. My goal is to use a while loop and create a search cursor that will merge the data in the address,city,state, and zipcode fields into the new FullAddR field I successfully added. My addfield management code added the field successfully and its blank. But, I think there is something wrong with my update cursor info in the while loop. I'm not sure how to use the row.setValue to merge all the info from the different fields into one if that's even the right direction i should be going in.



#import arcpy module
import arcpy
from arcpy import env
arcpy.env.overwriteOutput = True 
# I am setting the work path 
env = r'S:\\376\\Summer15-2\\ahutche1\\lab07_data\\SectionB\\'
#I am setting the variable for the hospitals shapefile
hospitals = 'Hospitals'
#I will add a new "FULLAddR" field to the table in the hospitals shapefile
arcpy.AddField_management(env+hospitals+'.shp','FullAddR', "FLOAT",20)
#I am setting the variable for the new field.
field1 = "FullAddR"
#I am setting the variables for the fields I want to take information from
#in order to merge it into the new field I just created.
address = "ADDRESS"
city = "CITY"
state = "STATE"
zipcode = "ZIPCODE"
#I will create a cursor to update the FullAddR field
cursor1 = arcpy.UpdateCursor(env+hospitals+'.shp') #I swill set up the update cursor
row =
#I will use a while loop in order to copy all the information from the
#city,state,address,and zipcode fields into the single FullAddR field. 
while row:
    row =