Skip to main content
correcting the @row_number variable
Source Link
HDunn
  • 8.7k
  • 3
  • 43
  • 73

If the area code number order does not matter you can try this:

  1. Calculate the number of similar "REGION" features with count(expression, group_by, filter)

  2. Order the shapefile according to "REGION". Its possible to do by MMQGIS plugin "sort-tool"

  3. Make unique "id" for all areas in field calculator with @rownumber@row_number

  4. Count numbers for areas in field calculator

"id" % "counted_areas" +1

If the area code number order does not matter you can try this:

  1. Calculate the number of similar "REGION" features with count(expression, group_by, filter)

  2. Order the shapefile according to "REGION". Its possible to do by MMQGIS plugin "sort-tool"

  3. Make unique "id" for all areas in field calculator with @rownumber

  4. Count numbers for areas in field calculator

"id" % "counted_areas" +1

If the area code number order does not matter you can try this:

  1. Calculate the number of similar "REGION" features with count(expression, group_by, filter)

  2. Order the shapefile according to "REGION". Its possible to do by MMQGIS plugin "sort-tool"

  3. Make unique "id" for all areas in field calculator with @row_number

  4. Count numbers for areas in field calculator

"id" % "counted_areas" +1

Source Link

If the area code number order does not matter you can try this:

  1. Calculate the number of similar "REGION" features with count(expression, group_by, filter)

  2. Order the shapefile according to "REGION". Its possible to do by MMQGIS plugin "sort-tool"

  3. Make unique "id" for all areas in field calculator with @rownumber

  4. Count numbers for areas in field calculator

"id" % "counted_areas" +1