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
> [email protected]
> 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

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Qgis-developer mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to