<div dir="ltr">Hi Nyall,<br><br><div class="gmail_extra"><br><div class="gmail_quote">2016-12-27 2:03 GMT+01:00 Nyall Dawson <span dir="ltr"><<a href="mailto:nyall.dawson@gmail.com" target="_blank">nyall.dawson@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 23 December 2016 at 23:37, Paolo Cavallini <<a href="mailto:cavallini@faunalia.it">cavallini@faunalia.it</a>> wrote:<br>
> Il 23/12/2016 14:32, Giovanni Manghi ha scritto:<br>
><br>
>> The solution from the Gitter discussion<br>
>><br>
>> aggregate( 'layername','max',"id")+1<br>
><br>
> thanks Giovanni<br>
><br>
>> We need of course a more user friendly way to allow users have<br>
>> incremental/serial ids in their shapefiles...<br>
><br>
> sure, e.g. a named preset expression, as previously suggested.<br>
> all the best.<br>
<br>
</span>In master you can add UNIQUE and NOT NULL constraints to the field<br>
from within QGIS. This will cause QGIS to automatically populate it<br>
with a serial type value whenever a new feature is created.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br>How does this work? I thought to document this tip in the User manual and wanted to give it a try before but always fail:<br></div><div>I created an integer field which is recognized in the Attribute Forms dialog as a range<br></div><div>I checked "unique" and "not null" constraints (and unchecked "allow null values" from the range widget properties)<br></div><div>The first created feature had value =0<br></div><div>The second one also got 0 with the yellow cross on the side But changes (with two 0 values) are saved in the layer.<br></div><div>Enforcing the constraints do not help, neither do setting the widget as "Text Edit".<br><br></div><div>Did I miss something (btw i'm using a temporary layer but also failed with shapefile) or is it broken.<br></div><div>Any help is welcome.<br><br></div><div>Thanks,<br></div><div>Harrissou<br></div><div><br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
Nyall<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
> --<br>
> Paolo Cavallini - <a href="http://www.faunalia.eu" rel="noreferrer" target="_blank">www.faunalia.eu</a><br>
> QGIS & PostGIS courses: <a href="http://www.faunalia.eu/training.html" rel="noreferrer" target="_blank">http://www.faunalia.eu/<wbr>training.html</a><br>
> <a href="https://www.google.com/trends/explore?date=all&geo=IT&q=qgis,arcgis" rel="noreferrer" target="_blank">https://www.google.com/trends/<wbr>explore?date=all&geo=IT&q=<wbr>qgis,arcgis</a><br>
> ______________________________<wbr>_________________<br>
> Qgis-developer mailing list<br>
> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
______________________________<wbr>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a></div></div></blockquote></div><br></div></div>