Skip to content
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

Layer variables missing from Field Calculator algorithm on QGIS 3.16.1 #40255

Closed
spatialthoughts opened this issue Nov 24, 2020 · 5 comments · Fixed by #41417
Closed

Layer variables missing from Field Calculator algorithm on QGIS 3.16.1 #40255

spatialthoughts opened this issue Nov 24, 2020 · 5 comments · Fixed by #41417
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority Processing Relating to QGIS Processing framework or individual Processing algorithms Regression Something which used to work, but doesn't anymore

Comments

@spatialthoughts
Copy link
Contributor

The expression engine is not able to access @layer and @layer_name variables from Field Calculator. They work fine elsewhere, i.e. via field calculator, or select by expression, but not from the Processing Toolbox. This works fine on 3.10 so it's a regression.
layer

QGIS and OS versions

QGIS version 3.16.0-Hannover QGIS code revision 4af1cbf
Compiled against Qt 5.14.2 Running against Qt 5.14.2
Compiled against GDAL/OGR 3.1.2 Running against GDAL/OGR 3.1.2
Compiled against GEOS 3.8.1-CAPI-1.13.3 Running against GEOS 3.8.1-CAPI-1.13.3
Compiled against SQLite 3.31.1 Running against SQLite 3.31.1
PostgreSQL Client Version 12.3 SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.4
Compiled against PROJ 6.3.2 Running against PROJ Rel. 6.3.2, May 1st, 2020
OS Version macOS 10.15
Active python plugins ORStools; slyr_community; QuickOSM; ee_plugin; profiletool; DataPlotly; quick_map_services; QNEAT3; pathfinder; qdraw; minimal; GeoCoding; ViewshedAnalysis; pluginbuilder3; show_time; latlontools; Qgis2threejs; qgsAzimuth; plugin_reloader; Mergin; processing; db_manager
@spatialthoughts spatialthoughts added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Nov 24, 2020
@gioman gioman added Regression Something which used to work, but doesn't anymore High Priority labels Nov 24, 2020
@PeterPetrik PeterPetrik self-assigned this Feb 8, 2021
@PeterPetrik PeterPetrik added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Feb 8, 2021
@PeterPetrik
Copy link
Contributor

Ok, looks like the variable is expanded OK when processing algorithm is run, but it is not shown in the list of available expressions and not in the auto-complete list

@troopa81
Copy link
Contributor

troopa81 commented Feb 8, 2021

@PeterPetrik I didn't notice you assigned yourself the issue and I was dealing with this one too. I think I found what the problem is, can I proceed with a PR or do you want to fix it yourself?

@PeterPetrik
Copy link
Contributor

Ok, feel free to assign to yourself and proceed. For future it is safer if you assign ticked to yourself when starting with it :)

I think moving the processing alg to C++ (https://github.com/qgis/QGIS/blame/master/src/analysis/processing/qgsalgorithmfieldcalculator.cpp) , @suricactus forgot to add project/layer to expression context

@PeterPetrik PeterPetrik assigned troopa81 and unassigned PeterPetrik Feb 8, 2021
@suricactus
Copy link
Contributor

Oops, true that. Thanks for taking care of that.

@troopa81
Copy link
Contributor

troopa81 commented Feb 8, 2021

For future it is safer if you assign ticked to yourself when starting with it :)

Sure, sorry about that!

troopa81 added a commit to troopa81/QGIS that referenced this issue Feb 9, 2021
nyalldawson pushed a commit to nyalldawson/QGIS that referenced this issue Feb 19, 2021
nyalldawson pushed a commit that referenced this issue Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority Processing Relating to QGIS Processing framework or individual Processing algorithms Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants