-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$rownum returns 0 in field calculator #24790
Comments
Author Name: Giovanni Manghi (@gioman) I just tested and does now happen here on Linux and Win7 with QGIS 2.18.10. Does it happen with any data of yours? tried without 3rd party plugins?
|
Author Name: A L (A L) I tried on at least two different layers, but both where postgis layers. |
Author Name: Giovanni Manghi (@gioman) A L wrote:
just tried with PostGIS layers on both Linxu and Windows and 2.18.10, works as expected (and starts from 1). To start without plugins @qgis --noplugins@ |
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman) A L wrote:
see attached image. The fact you are finding issues with this and not seeing the $row_num function suggests you have local issues. Try do cleanup (remove the .qgis2 folder, remove qgis registry entries) and try again.
|
Author Name: Nyall Dawson (@nyalldawson) Rownum is not available in virtual fields - that's why it's not shown in the expression builder when creating a virtual field. |
Author Name: A L (A L)
I did that and installed the latest 2.18.11. No change.
I tried with a regular field and it's not shown either. My PostGIS layer is a view, not a table, so a regular field does not work. That's where my problem is obviously. I need some way to add a unique id field to a read-only layer. |
Author Name: Nyall Dawson (@nyalldawson) Try $id instead of rownum. Regardless of the data source, rownum is not available in virtual fields. |
Author Name: A L (A L) Yes, I already tried that, but $id does not work very well when you filter the layer (i.e. not starting at 1, and holes in the series). |
Author Name: Giovanni Manghi (@gioman) A L wrote:
Please file a feature request instead. Cheers!
|
Author Name: A L (A L)
Original Redmine Issue: 16891
Affected QGIS version: 2.18.11
Redmine category:field_calculator
In QGIS 2.18.10, the $rownum function allways returns 0 in the field calculator.
As per #20365, it should return 0 in the expression field, but not in the field calculator.
Furthermore, the preview shows 1.
Is this some kind of regression ?
The text was updated successfully, but these errors were encountered: