[Qgis-developer] pyQgis-question

luca_manganelli at comune.trento.it luca_manganelli at comune.trento.it
Tue Sep 28 02:34:16 EDT 2010


qgis-developer-bounces at lists.osgeo.org scritti il 28/09/2010 08.21.31

> myIdx = myLayer.fieldNameIndex( 'myfield' )
> newFeature.changeAttribute( myIdx, newValue )
> #does not change the field value to new value :-(

> what is the second argument of changeAttribute supposed to be?

>From my 'homemade' plugin:

      self.lay_stradearchi.changeAttributeValue (self.minFeature.id(),

self.lay_stradearchi.dataProvider().fieldNameIndex("FIELDNAME"),
                        self.dlgEdit.ui.newCode.text())

First argument is the FEATURE ID,
second argument is the index of the field,
third is the new value.

HTH.



More information about the Qgis-developer mailing list