[GIS] How to add a column in an attribute table using QGIS graphical modeler

field-calculatormodelqgis

I have started to make a model in QGIS 2.2 graphical modeler. I have made a buffer around a polyline and used it to clip a polygon layer. So far i t works.

But the next step is to add a new column to the clipped polygon layer, and get that column to include rownumber? I have done this outside of the model before, but I don't understand how to make it work inside the model? I tried using the algorithm 'Field calculator' but it doesn't work.

How do I use the field calculator inside a model?

EDIT: Is there any other way of adding a column with rownumbers to the attribute table inside the model? I got the tip to use the 'Advanced Python field calculator' in an answer below, but I don't understand how to use it.

screenshot python field calculator

Best Answer

The Advanced Python Field Calculator works. The Syntax is a bit diffrent but value = $id should work.

Related Question