Bug report #20990

row_number

Added by Cesar Herrera almost 6 years ago. Updated almost 6 years ago.

Status:Rejected
Priority:Normal
Assignee:-
Category:Attribute table
Affected QGIS version:3.4.3 Regression?:No
Operating System:W10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:28809

Description

The instruction row_number works fine in field calculator but the same instruction doesn't work in "attribute form".

Captura-Row_number.JPG (140 KB) Cesar Herrera, 2019-01-14 08:17 AM

History

#1 Updated by Nyall Dawson almost 6 years ago

  • Resolution set to invalid
  • Status changed from Open to Rejected

That's because it has no meaning there -- there's no row to take the number from. Try $id instead.

#2 Updated by Cesar Herrera almost 6 years ago

Nyall Dawson wrote:

That's because it has no meaning there -- there's no row to take the number from. Try $id instead.

Thanks Nyall for your fast answer. $id Is not a good option because working with geopackage fid is authomatic and if you delete any row, the number will not be consecutive (let me try to show you and example. I need to automatise a consecutive id in a point layer. I need as shown in @row_number: 1 2 3 ):
First you create 5 points: fid will be: 1 2 3 4 5 and @row_number will be: 1 2 3 4 5
Then Delete 3 and 4. fid will remain: 1 2 5 but @row__number will be: 1 2 3

Thanks

Also available in: Atom PDF