[Qgis-developer] Update Fields Selected Features.
Matthias Kuhn
matthias at opengis.ch
Thu Jan 7 08:56:03 PST 2016
Hi,
The second line reverts the changes from the first line here:
/ lyr.changeAttributeValue(fid,12,"0")//
// lyr.updateFeature(f)/
Either use
/ lyr.changeAttributeValue(fid,12,"0")//
/or
// f[12] = 0/
lyr.updateFeature(f)/
Cheers
Matthias
On 01/07/2016 05:52 PM, Luís Miguel Royo Pérez wrote:
> Hello everyone,
>
> I'm trying to modify the values of some selected features. I have
> written this small script, but nothing happens when I run it. Is there
> something that I've missed? Here is my code.
>
> /lyr = qgis.utils.iface.activeLayer()//
> //features = lyr.selectedFeatures()//
> //
> //lyr.startEditing()//
> //lyr.updateFields()//
> //for f in features://
> // fid= f.id()//
> // lyr.changeAttributeValue(fid,12,"0")//
> // lyr.updateFeature(f)//
> // print "elemento alterado"//
> //
> //lyr.commitChanges()/
>
> Thanks per advance!!
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
--
Matthias Kuhn
OPENGIS.ch - https://www.opengis.ch
Spatial • (Q)GIS • PostGIS • Open Source
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160107/49fd13c7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160107/49fd13c7/attachment.sig>
More information about the Qgis-developer
mailing list