jdrvar

Python script to enter String & Dates in existing fields

Discussion created by jdrvar on Jul 19, 2013
Latest reply on Jul 22, 2013 by jdrvar
All,

I am attempting to write a Python Script that selects a record in the attribute table, zooms to the selected feature, and prompts the user to enter their name, date created, and date modified.  The name, date created, and date modified fields already exist in the attribute table.  The name field is a string type, and the date fields are date types.  I have the first part of the script written, it prompts the user to enter a RENUM value, which selects a record in the Parcels attribute table, and zooms to the selected feature.  How would I get the script to prompt the user to enter their name, date created, and date modified?  Then, have the information they enter stored in the attribute table?  I am going to have the users run the script from ArcToolbox.   Any suggestions would be welcomed.  Thanks.  What I have so far is displayed below:

#Import
import arcpy

#Variables
Parcels = arcpy.GetParameterAsText(0)

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "Parcels", df)[0]
arcpy.AddMessage(lyr.name)

#Logic
try:
 whereClause = "RENUM = "+Parcels+""
 arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause)
 df.extent = lyr.getSelectedExtent()
 df.scale = df.scale*1.1

except:
 print arcpy.GetMessages()

Outcomes