GeoEco.Datasets.InsertCursor.SetValue

InsertCursor.SetValue(field, value)

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

Note

The new row is not actually submitted through the underlying programming library to the underlying data store until InsertRow() is called. If you call SetValue() but then neglect to call InsertRow() before closing the cursor, your row will not be inserted.

Parameters:
  • field (str) –

    Name of the field to set the value of.

    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.