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

Expression to populate one field based on another field value does not work #2540

Closed
josemvm opened this issue Oct 17, 2021 · 7 comments
Closed
Labels
bug feedback stale This ticket might be closed soon

Comments

@josemvm
Copy link
Collaborator

josemvm commented Oct 17, 2021

What is the bug?

i'am using a case expression for default value

imagem
and when i use edition form on qgis desktop it works as expected
imagem
but not on lizmap
imagem

lizmap plugin version: 3.6.3

Steps to reproduce the issue

.

Lizmap version

3.4.6

QGIS desktop version

3.16.10

QGIS server version

3.16.10

Operating system

Ubuntu 20.04

Browsers

Firefox

Browsers version

93.0

Relevant log output

No response

@josemvm
Copy link
Collaborator Author

josemvm commented Oct 27, 2021

qgis server logs:

the expression appears like this:

09:47:58 INFO Server[434543]: EXPRESSIONS:{"descricao":"CASE  \r\nWHEN \"natureza\"  = '3101' THEN 'Inc\u00eandio Florestal' \r\nWHEN \"natureza\"  = '3103' THEN 'Inc\u00eandio Mato'  \r\nWHEN \"natureza\"  = '3105' THEN 'Inc\u00eandio Agr\u00edcola' \r\nWHEN \"natureza\"  = '3301' THEN 'Queda de \u00c1rvore'\r\nWHEN \"natureza\"  = '3311' THEN 'Queda Elementos de Constru\u00e7\u00e3o'\r\nWHEN \"natureza\"  = '3313' THEN 'Movimento de Massa'\r\nWHEN \"natureza\"  = '3315' THEN 'Inunda\u00e7\u00e3o por precipita\u00e7\u00e3o intensa'\r\nWHEN \"natureza\"  = '3329' THEN 'Queda de Estrutura'\r\nWHEN \"natureza\"  = '9101' THEN 'Queda de Neve'\r\nEND"}

@Gustry
Copy link
Member

Gustry commented Oct 27, 2021

Any other logs which might help ? (IE a few lines more after this one), especially the return of this request ? What QGIS is returning ?

@josemvm
Copy link
Collaborator Author

josemvm commented Oct 27, 2021

10:09:39 INFO Server[434543]: ******************** New request ***************
10:09:39 INFO Server[434543]: Request URL: http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?service=LIZMAP&request=GetServerSettings&map=%2Fvar%2Fwww%2Fhtml%2Flizmap_web_client%2Flizmap%2Finstall%2Fma%2FeventosExtremos.qgs
10:09:39 INFO Server[434543]: Environment:
10:09:39 INFO Server[434543]: ------------------------------------------------
10:09:39 INFO Server[434543]: SERVER_NAME: 127.0.0.1
10:09:39 INFO Server[434543]: REQUEST_URI: /cgi-bin/qgis_mapserv.fcgi?service=LIZMAP&request=GetServerSettings&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2FeventosExtremos%2Eqgs
10:09:39 INFO Server[434543]: SCRIPT_NAME: /cgi-bin/qgis_mapserv.fcgi
10:09:39 INFO Server[434543]: REMOTE_ADDR: 127.0.0.1
10:09:39 INFO Server[434543]: SERVER_PORT: 80
10:09:39 INFO Server[434543]: QUERY_STRING: service=LIZMAP&request=GetServerSettings&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2FeventosExtremos%2Eqgs
10:09:39 INFO Server[434543]: REQUEST_METHOD: GET
10:09:39 INFO Server[434543]: HTTP_ACCEPT: */*
10:09:39 INFO Server[434543]: HTTP_USER_AGENT: Lizmap
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.requestReady
10:09:39 INFO Lizmap[434543]: Request headers provided
10:09:39 INFO Lizmap[434543]: No lizmap user groups in request headers
10:09:39 INFO Server[434543]: MAP:/var/www/html/lizmap_web_client/lizmap/install/ma/eventosExtremos.qgs
10:09:39 INFO Server[434543]: REQUEST:GetServerSettings
10:09:39 INFO Server[434543]: SERVICE:LIZMAP
10:09:39 WARNING [434543]: Service CADASTRE is not registered
10:09:39 INFO Lizmap[434543]: Sending JSON response : {'qgis': {'version': '3.16.10', 'name': 'Hannover', 'version_int': 31610}, 'gdalogr': {'name': 'GDAL 3.0.4, released 2020/01/28', 'version_int': '3000400'}, 'services': ['WMS', 'WFS', 'WCS', 'WMTS', 'ATLAS', 'EXPRESSION', 'LIZMAP'], 'lizmap': {'name': 'Lizmap', 'version': '3.6.3'}}
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.responseComplete
10:09:39 INFO Server[434543]: Request finished in 2 ms
10:09:39 INFO Server[434543]: ******************** New request ***************
10:09:39 INFO Server[434543]: Request URL: http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?service=WMS&request=GetCapabilitiesAtlas&map=%2Fvar%2Fwww%2Fhtml%2Flizmap_web_client%2Flizmap%2Finstall%2Fma%2FeventosExtremos.qgs
10:09:39 INFO Server[434543]: Environment:
10:09:39 INFO Server[434543]: ------------------------------------------------
10:09:39 INFO Server[434543]: SERVER_NAME: 127.0.0.1
10:09:39 INFO Server[434543]: REQUEST_URI: /cgi-bin/qgis_mapserv.fcgi?service=WMS&request=GetCapabilitiesAtlas&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2FeventosExtremos%2Eqgs
10:09:39 INFO Server[434543]: SCRIPT_NAME: /cgi-bin/qgis_mapserv.fcgi
10:09:39 INFO Server[434543]: REMOTE_ADDR: 127.0.0.1
10:09:39 INFO Server[434543]: SERVER_PORT: 80
10:09:39 INFO Server[434543]: QUERY_STRING: service=WMS&request=GetCapabilitiesAtlas&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2FeventosExtremos%2Eqgs
10:09:39 INFO Server[434543]: REQUEST_METHOD: GET
10:09:39 INFO Server[434543]: HTTP_ACCEPT: */*
10:09:39 INFO Server[434543]: HTTP_USER_AGENT: Lizmap
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.requestReady
10:09:39 INFO Lizmap[434543]: Request headers provided
10:09:39 INFO Lizmap[434543]: No lizmap user groups in request headers
10:09:39 INFO Server[434543]: MAP:/var/www/html/lizmap_web_client/lizmap/install/ma/eventosExtremos.qgs
10:09:39 INFO Server[434543]: REQUEST:GetCapabilities
10:09:39 INFO Server[434543]: SERVICE:ATLAS
10:09:39 INFO Server[434543]: VERSION:1.0.0
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.responseComplete
10:09:39 INFO Server[434543]: Request finished in 1 ms
10:09:39 INFO Server[434543]: ******************** New request ***************
10:09:39 INFO Server[434543]: Request URL: http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?
10:09:39 INFO Server[434543]: Environment:
10:09:39 INFO Server[434543]: ------------------------------------------------
10:09:39 INFO Server[434543]: SERVER_NAME: 127.0.0.1
10:09:39 INFO Server[434543]: REQUEST_URI: /cgi-bin/qgis_mapserv.fcgi
10:09:39 INFO Server[434543]: SCRIPT_NAME: /cgi-bin/qgis_mapserv.fcgi
10:09:39 INFO Server[434543]: REMOTE_ADDR: 127.0.0.1
10:09:39 INFO Server[434543]: SERVER_PORT: 80
10:09:39 INFO Server[434543]: QUERY_STRING:
10:09:39 INFO Server[434543]: CONTENT_TYPE: application/x-www-form-urlencoded
10:09:39 INFO Server[434543]: REQUEST_METHOD: POST
10:09:39 INFO Server[434543]: HTTP_ACCEPT: */*
10:09:39 INFO Server[434543]: HTTP_USER_AGENT: Lizmap
10:09:39 WARNING [434543]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.requestReady
10:09:39 INFO Lizmap[434543]: Request headers provided
10:09:39 INFO Lizmap[434543]: No lizmap user groups in request headers
10:09:39 INFO Server[434543]: EXPRESSIONS:{"descricao":"CASE  \r\nWHEN \"natureza\"  = '3101' THEN 'Inc\u00eandio Florestal' \r\nWHEN \"natureza\"  = '3103' THEN 'Inc\u00eandio Mato'  \r\nWHEN \"natureza\"  = '3105' THEN 'Inc\u00eandio Agr\u00edcola' \r\nWHEN \"natureza\"  = '3301' THEN 'Queda de \u00c1rvore'\r\nWHEN \"natureza\"  = '3311' THEN 'Queda Elementos de Constru\u00e7\u00e3o'\r\nWHEN \"natureza\"  = '3313' THEN 'Movimento de Massa'\r\nWHEN \"natureza\"  = '3315' THEN 'Inunda\u00e7\u00e3o por precipita\u00e7\u00e3o intensa'\r\nWHEN \"natureza\"  = '3329' THEN 'Queda de Estrutura'\r\nWHEN \"natureza\"  = '9101' THEN 'Queda de Neve'\r\nEND"}
10:09:39 INFO Server[434543]: LAYER:ocorrencias_cdos
10:09:39 INFO Server[434543]: MAP:/var/www/html/lizmap_web_client/lizmap/install/ma/eventosExtremos.qgs
10:09:39 INFO Server[434543]: REQUEST:Evaluate
10:09:39 INFO Server[434543]: SERVICE:EXPRESSION
10:09:39 INFO Lizmap[434543]: Request headers provided
10:09:39 INFO Lizmap[434543]: No lizmap user groups in request headers
10:09:39 INFO Lizmap[434543]: Request headers provided
10:09:39 INFO Lizmap[434543]: No lizmap user login in request headers
10:09:39 INFO Lizmap[434543]: Sending JSON response : {'status': 'success', 'results': [{'descricao': None}], 'errors': [{'descricao': "No feature available for field 'natureza' evaluation"}], 'features': 0}
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.responseComplete
10:09:39 INFO Server[434543]: Request finished in 1 ms
10:09:39 INFO Server[434543]: ******************** New request ***************
10:09:39 INFO Server[434543]: Request URL: http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?service=LIZMAP&request=GetServerSettings&map=%2Fvar%2Fwww%2Fhtml%2Flizmap_web_client%2Flizmap%2Finstall%2Fma%2FeventosExtremos.qgs
10:09:39 INFO Server[434543]: Environment:
10:09:39 INFO Server[434543]: ------------------------------------------------
10:09:39 INFO Server[434543]: SERVER_NAME: 127.0.0.1
10:09:39 INFO Server[434543]: REQUEST_URI: /cgi-bin/qgis_mapserv.fcgi?service=LIZMAP&request=GetServerSettings&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2FeventosExtremos%2Eqgs
10:09:39 INFO Server[434543]: SCRIPT_NAME: /cgi-bin/qgis_mapserv.fcgi
10:09:39 INFO Server[434543]: REMOTE_ADDR: 127.0.0.1
10:09:39 INFO Server[434543]: SERVER_PORT: 80
10:09:39 INFO Server[434543]: QUERY_STRING: service=LIZMAP&request=GetServerSettings&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2FeventosExtremos%2Eqgs
10:09:39 INFO Server[434543]: REQUEST_METHOD: GET
10:09:39 INFO Server[434543]: HTTP_ACCEPT: */*
10:09:39 INFO Server[434543]: HTTP_USER_AGENT: Lizmap
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.requestReady
10:09:39 INFO Lizmap[434543]: Request headers provided
10:09:39 INFO Lizmap[434543]: No lizmap user groups in request headers
10:09:39 INFO Server[434543]: MAP:/var/www/html/lizmap_web_client/lizmap/install/ma/eventosExtremos.qgs
10:09:39 INFO Server[434543]: REQUEST:GetServerSettings
10:09:39 INFO Server[434543]: SERVICE:LIZMAP
10:09:39 WARNING [434543]: Service CADASTRE is not registered
10:09:39 INFO Lizmap[434543]: Sending JSON response : {'qgis': {'version': '3.16.10', 'name': 'Hannover', 'version_int': 31610}, 'gdalogr': {'name': 'GDAL 3.0.4, released 2020/01/28', 'version_int': '3000400'}, 'services': ['WMS', 'WFS', 'WCS', 'WMTS', 'ATLAS', 'EXPRESSION', 'LIZMAP'], 'lizmap': {'name': 'Lizmap', 'version': '3.6.3'}}
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.responseComplete
10:09:39 INFO Server[434543]: Request finished in 1 ms
10:09:39 INFO Server[434543]: ******************** New request ***************
10:09:39 INFO Server[434543]: Request URL: http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?service=WMS&request=GetCapabilitiesAtlas&map=%2Fvar%2Fwww%2Fhtml%2Flizmap_web_client%2Flizmap%2Finstall%2Fma%2FeventosExtremos.qgs
10:09:39 INFO Server[434543]: Environment:
10:09:39 INFO Server[434543]: ------------------------------------------------
10:09:39 INFO Server[434543]: SERVER_NAME: 127.0.0.1
10:09:39 INFO Server[434543]: REQUEST_URI: /cgi-bin/qgis_mapserv.fcgi?service=WMS&request=GetCapabilitiesAtlas&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2FeventosExtremos%2Eqgs
10:09:39 INFO Server[434543]: SCRIPT_NAME: /cgi-bin/qgis_mapserv.fcgi
10:09:39 INFO Server[434543]: REMOTE_ADDR: 127.0.0.1
10:09:39 INFO Server[434543]: SERVER_PORT: 80
10:09:39 INFO Server[434543]: QUERY_STRING: service=WMS&request=GetCapabilitiesAtlas&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2FeventosExtremos%2Eqgs
10:09:39 INFO Server[434543]: REQUEST_METHOD: GET
10:09:39 INFO Server[434543]: HTTP_ACCEPT: */*
10:09:39 INFO Server[434543]: HTTP_USER_AGENT: Lizmap
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.requestReady
10:09:39 INFO Lizmap[434543]: Request headers provided
10:09:39 INFO Lizmap[434543]: No lizmap user groups in request headers
10:09:39 INFO Server[434543]: MAP:/var/www/html/lizmap_web_client/lizmap/install/ma/eventosExtremos.qgs
10:09:39 INFO Server[434543]: REQUEST:GetCapabilities
10:09:39 INFO Server[434543]: SERVICE:ATLAS
10:09:39 INFO Server[434543]: VERSION:1.0.0
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.responseComplete
10:09:39 INFO Server[434543]: Request finished in 0 ms
10:09:39 INFO Server[434543]: ******************** New request ***************
10:09:39 INFO Server[434543]: Request URL: http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?
10:09:39 INFO Server[434543]: Environment:
10:09:39 INFO Server[434543]: ------------------------------------------------
10:09:39 INFO Server[434543]: SERVER_NAME: 127.0.0.1
10:09:39 INFO Server[434543]: REQUEST_URI: /cgi-bin/qgis_mapserv.fcgi
10:09:39 INFO Server[434543]: SCRIPT_NAME: /cgi-bin/qgis_mapserv.fcgi
10:09:39 INFO Server[434543]: REMOTE_ADDR: 127.0.0.1
10:09:39 INFO Server[434543]: SERVER_PORT: 80
10:09:39 INFO Server[434543]: QUERY_STRING:
10:09:39 INFO Server[434543]: CONTENT_TYPE: application/x-www-form-urlencoded
10:09:39 INFO Server[434543]: REQUEST_METHOD: POST
10:09:39 INFO Server[434543]: HTTP_ACCEPT: */*
10:09:39 INFO Server[434543]: HTTP_USER_AGENT: Lizmap
10:09:39 WARNING [434543]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.requestReady
10:09:39 INFO Lizmap[434543]: Request headers provided
10:09:39 INFO Lizmap[434543]: No lizmap user groups in request headers
10:09:39 INFO Server[434543]: FIELDS:gid,gid
10:09:39 INFO Server[434543]: FILTER:intersects($geometry, @current_geometry)
10:09:39 INFO Server[434543]: FORM_FEATURE:{"type":"Feature","geometry":null,"properties":[]}
10:09:39 INFO Server[434543]: LAYER:c_freguesias
10:09:39 INFO Server[434543]: MAP:/var/www/html/lizmap_web_client/lizmap/install/ma/eventosExtremos.qgs
10:09:39 INFO Server[434543]: REQUEST:getFeatureWithFormScope
10:09:39 INFO Server[434543]: SERVICE:EXPRESSION
10:09:39 INFO Lizmap[434543]: Request headers provided
10:09:39 INFO Lizmap[434543]: No lizmap user groups in request headers
10:09:39 INFO Lizmap[434543]: Request headers provided
10:09:39 INFO Lizmap[434543]: No lizmap user login in request headers
10:09:39 INFO WfsOutputExtension[434543]: WfsOutputExtension.responseComplete
10:09:39 INFO Server[434543]: Request finished in 7 ms

@josemvm
Copy link
Collaborator Author

josemvm commented Jan 25, 2022

hi @Gustry is it expected to work with lizmap plugin installed on qgis server (or not) ?
thanks

@josemvm
Copy link
Collaborator Author

josemvm commented Jun 8, 2023

#3226
the expression for default value doesn't work for existing objects nor for new objects on lwc 3.6(.4)

@Gustry
Copy link
Member

Gustry commented Jun 8, 2023

It depends of the content of the expression. Expressions not using fields with are within the same form are working, such as dates, @lizmap_user...
It's a just a quick answer, I don't know all corner cases, when/where expressions are evaluated (especially when fields are involved)

@3liz-bot
Copy link
Contributor

This issue is missing some feedbacks. 👻
Please have a look to the discussion, thanks. 🦎

@3liz-bot 3liz-bot added the stale This ticket might be closed soon label Jul 11, 2023
@3liz-bot 3liz-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug feedback stale This ticket might be closed soon
Projects
None yet
Development

No branches or pull requests

3 participants