boothtp

Populate a single field of a manually selected attribute(not with select by location)

Discussion created by boothtp on Jun 8, 2011
Latest reply on Jun 8, 2011 by boothtp
Hello I posed this question yesterday and I received a few good ideas... here is a link to yesterdays questions and responses...
http://forums.arcgis.com/threads/32112-Update-a-single-attribute-field-of-manually-selected-features-%28not-sel-by-location%29

Now that I have more time I can elaborate further and hopefully receive some more feed back.  I am trying to create a script tool in arc toolbox that will auto populate an elevation field.  Here is the current process....  Right now I select one point feature (manhole feature) I have to manually do a simple math calculation using the default calculator on my computer.  I then have to type that answer in the the elevation field in the manhole feature class.  This is very tedious and includes possible user error since I have to manually type in numbers all day into a calculator and then manually put them into the elevation field for that manhole.  So far I have used gp.CalculateField.management but it populates the entire field even though I only have one feature selected(This is just a demo script to see if it populated my ONE selected feature, I have not added my math function/calulation in yet)..

import arcgisscripting, sys
gp = arcgisscripting.create(9.3)
gp.workspace = "C:/Users/slew/Documents"
gp.CalculateField_management("LiDARCalls_OriginalCopy.shp","elevation", "56")

Someone told me to try this..  However this also populated the whole elevation field for all features..

import arcgisscripting, sys
gp = arcgisscripting.create(9.3)
gp.workspace = "C:/Users/slew/Documents"
print "Creating lyr.. "  
gp.MakeFeatureLayer_management("LiDARCalls_OriginalCopy.shp", "lyr")
print "Selecting..."   
gp.SelectLayerByAttribute_management("lyr", "NEW_SELECTION", "elevation")
print "Calculating..."
gp.CalculateField_management("LiDARCalls_OriginalCopy.shp","elevation", 44)

This seems like it would be very simple but I can't figure out how to update only one feature at a time....

Any help/thoughts/ideas will be appreciated..

Outcomes