Bug report #19431

$rownum (and possibly other functions) do not work on virtual fields

Added by Giovanni Manghi over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Field calculator
Affected QGIS version:3.3(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:wontfix
Crashes QGIS or corrupts data:No Copied to github as #:27259

Description

It always return "0".

Another example is "count", which returns always NULL.

Tested on LTR and master.

On non virtual fields are ok.

History

#1 Updated by Luigi Pirelli over 5 years ago

confirmed on master an 2.18 LTR

#2 Updated by Luigi Pirelli over 5 years ago

rownumber is filled here
https://github.com/qgis/QGIS/blob/master/src/app/qgsfieldcalculator.cpp#L274

but completly skipped here
https://github.com/qgis/QGIS/blob/master/src/app/qgsfieldcalculator.cpp#L197 in case of virtualfields

probably a simple if reorganization would solve... investigating more

#3 Updated by Nyall Dawson over 5 years ago

  • Resolution set to wontfix
  • Status changed from Open to Closed

It's deliberately not exposed here, because it has no meaning outside of the field calculator (since virtual fields are "global" for a layer, yet the layer may be opened in two different attribute table dialogs both with different sort orders). Use $id instead.

Also available in: Atom PDF