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

Nyall Dawson nyall.dawson at gmail.com
Mon Dec 26 17:03:29 PST 2016


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
> 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


More information about the Qgis-developer mailing list