[Qgis-developer] $id not working as default value

Neumann, Andreas a.neumann at carto.net
Mon Dec 26 23:40:06 PST 2016


Hi Nyall, 

Thanks for clarifying. 

This needs to be properly documented and taught in QGIS courses. 

Andreas 

On 2016-12-27 02:03, Nyall Dawson wrote:

> On 23 December 2016 at 23:37, Paolo Cavallini <cavallini at faunalia.it> wrote: Il 23/12/2016 14:32, Giovanni Manghi ha scritto:
> 
> The solution from the Gitter discussion
> 
> aggregate( 'layername','max',"id")+1 
> thanks Giovanni
> 
> We need of course a more user friendly way to allow users have
> incremental/serial ids in their shapefiles... 
> sure, e.g. a named preset expression, as previously suggested.
> all the best.

In master you can add UNIQUE and NOT NULL constraints to the field
from within QGIS. This will cause QGIS to automatically populate it
with a serial type value whenever a new feature is created.

Nyall

> --
> Paolo Cavallini - www.faunalia.eu [1]
> QGIS & PostGIS courses: http://www.faunalia.eu/training.html
> https://www.google.com/trends/explore?date=all&geo=IT&q=qgis,arcgis
> _______________________________________________
> 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
 _______________________________________________
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 

  

Links:
------
[1] http://www.faunalia.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20161227/481126cf/attachment.html>


More information about the Qgis-developer mailing list