<div dir="auto"><div>Hi Nyall,<div dir="auto"><br></div><div dir="auto">It is indeed a QgsExpression object. I 'm able to use it in the field calculator so it should work...</div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Op di 5 feb. 2019 22:25 schreef Nyall Dawson <<a href="mailto:nyall.dawson@gmail.com">nyall.dawson@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, 6 Feb 2019 at 00:37, Wouter Impens <<a href="mailto:wouter.impens@gmail.com" target="_blank" rel="noreferrer">wouter.impens@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> Hope anyone can help me with this:<br>
><br>
> I'm trying to iterate over the fields of a vector layer (using the index) and fill in the values by an expression<br>
><br>
>  my_features = a_layer.getFeatures()<br>
>     for a_feat in my_features:<br>
>         mijn_index = a_feat.fieldNameIndex('perc_nr')<br>
>         value = an_expr<br>
<br>
What's "an_expr" here? Is it a QgsExpression object?<br>
<br>
Nyall<br>
<br>
>          a_feat.setAttribute(mijn_index, value)<br>
><br>
>     a_layer.commitChanges()<br>
><br>
> I don't get an error but nothing is filled in. I evaluated the expression and it's true. It also works in the field calculator.<br>
><br>
> Anyone an idea?<br>
><br>
><br>
> Kind regards<br>
> Wouter<br>
> _______________________________________________<br>
> Qgis-user mailing list<br>
> <a href="mailto:Qgis-user@lists.osgeo.org" target="_blank" rel="noreferrer">Qgis-user@lists.osgeo.org</a><br>
> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</blockquote></div></div></div>