Pregunta

Good day, I am stuck on an issue I would like to see if anyone knows how to fix this, I have a python script that is to control a field in access. I need to be able to view data in the field as well as write new info to the db. I know I need to use an UpdateCursor. But when I run this I get several errors, errors that I don't know how to fix. I am new to python. I am simply trying to write new data in the combobox into the mdb. here is one class for one field in my table.

class ISDComboBoxClass3(object):
"""Implementation for WOformV2_addin.combobox (ComboBox)"""
def __init__(self):
    #self.items = ["12/1/2000", "5/3/2010"]
    self.editable = True
    self.enabled = True
    self.dropdownWidth = 'WWWWWW'
    self.width = 'WWWWWW'
def onSelChange(self, selection):
    pass
def onEditChange(self, text):
    fc = 'C:\GISdata\WO\WorkOrderData.shp'
    field1 = "ISD"

    cursor = arcpy.UpdateCursor(fc)
    for row in cursor:
        row.setValue(field1)
        cursor.updateRow(row)
def onFocus(self, focused):
    fc = 'C:\GISdata\WO\WorkOrderData.shp'
    field1 = "ISD"

    cursor = arcpy.UpdateCursor(fc)
    for row in cursor:
        row.setValue("ISD")
        cursor.updateRow(row)

def refresh(self):
    pass
¿Fue útil?

Solución

Looking at the ArcGIS documentation, it looks like row.setValue requires 2 arguments.
example: row.setValue(FieldIndex, value) http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000064000000

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top