GeoEco.Datasets.UpdateCursor.SetValue

UpdateCursor.SetValue(field, value)

Sets the value of a field of the current row, given the name of the field and its new value.

Note

Changes to the row are not actually submitted through the underlying programming library to the underlying data store until UpdateRow() is called. If you call SetValue() but then neglect to call UpdateRow() before calling NextRow(), your changes will be lost.

Parameters:
  • field (str) –

    Name of the field to set the value of.

    If you specified a list of fields to retrieve when you opened the cursor, you will only be able to set the values of those fields. If you did not specify such a list, then you will be able to set all of the fields of the Table.

    This function cannot be used to set the geometry of the row, even if the underlying data format stores the geometry in a named field. Use SetGeometry() instead.

    This function cannot be used to set the ArcGIS “object ID” field. That field is read-only and managed by the underlying data store or programming library used to access it.

    The underlying data store or programming library may expose other read-only fields. For example, some versions of ArcGIS maintain fields called Shape_Length and Shape_Area in feature classes of ArcGIS geodatabases. These may not be set either. To determine if a field may be set, call GetFieldByName() on the Table and examine the IsSettable property of the returned Field instance. Minimum length꞉ 1.

  • value (object) –

    Value of the field.

    To set the field to a database NULL, use None. Otherwise, you must provide an instance of the Python type that is appropriate for the data type of the field:

    Field Data Type

    Appropriate Python Type

    binary

    str

    date, datetime

    datetime.datetime

    float32, float64

    float

    int16, int32

    int

    string

    str

    To determine the data type of a field, call GetFieldByName() on the Table and examine the DataType property of the returned Field instance.