Bug report #19431
$rownum (and possibly other functions) do not work on virtual fields
|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|
It always return "0".
Another example is "count", which returns always NULL.
Tested on LTR and master.
On non virtual fields are ok.
#2 Updated by Luigi Pirelli almost 2 years ago
rownumber is filled here
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 almost 2 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.