Is there a way to number a subset of entries in the attribute table based on the current sorting in Qgis? e.g. select all entries with attribute X, sort them by abttribute Y, create a new column and fill the column (only for the selected and sorted values) whith 1 to n; not rownum or id.
1 Answer
I guess you might have a solution in QGIS 3.2 with a new feature added, thanks to Nyall Dawson (North Road). I haven't tried, but i guess oyou could try filtering the layer before running this new tool ?
Feature: Sort order option for "Add Incremental Field"
This change allows users to optionally set a sort order to use when assigning values in the Add Incremental Field algorithm. Previously values were always added using the original feature order. With this change users can control the order in which features are assigned values.
-
1works like a charme, was exactly what i needed. particularly the "group values by" to define ordered groups! thanks! Feb 6, 2019 at 9:52
-
Happy to know it helped ! Thanks for your detailed comment on your usage.– gisnsideFeb 6, 2019 at 15:45
$rownum
. There is also an approach with using Calc gis.stackexchange.com/a/41506/24484 but for me it didn't work.