[Qgis-developer] Update Fields Selected Features.
Luís Miguel Royo Pérez
luis.miguel.royo at gmail.com
Thu Jan 7 09:10:49 PST 2016
Thanks a lot! It worked!! :D
El 07/01/2016 a las 17:56, Matthias Kuhn escribió:
> 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
>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160107/0ffc98f4/attachment.html>
More information about the Qgis-developer
mailing list