3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
260 stars 143 forks source link

[Bug]: Default values does not work in edition form when using overlay_contains #4830

Closed vlebert closed 1 week ago

vlebert commented 1 month ago

What is the bug? (in English)

I have an edition form valid in QGIS where the default value of a given field is calculated with this QGIS formula:

concat(
array_to_string(array_distinct(array_cat(overlay_contains('t_adresse_8a01a16e_9319_4737_b06e_dbc3c0b9e51d',expression:=ad_code,limit:=-1),overlay_contains('t_adresse_a5e83ddd_a3a9_4405_ac48_64b82d9245df',expression:=ad_code,limit:=-1), overlay_contains('t_adresse_2023_f1910257_f166_45a3_8af4_8639ad110a25',expression:=ad_code,limit:=-1)))))

This does not work in Lizmap when client

Steps to reproduce the issue

Make a prefilled field based on overlay_contains formulas

Versions, safeguards, check summary etc

Versions :

List of safeguards :
* Mode : normal * Allow parent folder : no * Prevent other drive : yes * Prevent PG service : no * Prevent PG Auth DB : yes * Force PG user&pass : yes * Prevent ECW : yes

Check Lizmap plugin

Operating system

Lizmap hosted

Browsers

Chrome

Browsers version

129.0.6668.71

Relevant log output

No response

Gustry commented 1 month ago

Can you add more context ? Is the expression evaluated as soon as you open the form in QGIS ? Or after some values in the form ? Maybe with the field ad_code ? Or is a static expression ?

Is-it on feature creation or modification ?

Related to #3226 ?

vlebert commented 1 month ago

Does this help ? It does not work on feature creation in Lizmap while it works in QGIS

Yes it is evaluated as soon as the form is opened in QGIS

digi-studio 2024-10-02 at 14 44 05

Gustry commented 1 month ago

Before opening your form in Lizmap, can you open your "developer tools" F12, and see if there is an HTTP requests when you open the form ? In the "Network" tab. There is one HTTP request for the form itself and another one for expressions I think

vlebert commented 1 month ago

hi @Gustry

Here is a screenshot. But I don't see any interesting information here. Would you like more detail

I think the issue is that the form pops up before geometry drawing. That mean the formula can't be evaluated.

I tried keeping the default value formula in QGIS but removing the field from the edit form, but same results

bug lizmap form create

digi-studio 2024-10-03 at 09 49 31

Gustry commented 1 month ago

I think the issue is that the form pops up before geometry drawing. That mean the formula can't be evaluated.

Yes, this is definetely a blocker. In QGIS, we first click on the map, then the form opens. In Lizmap, it's the reverse, the form opens and then we can click on the map.

So you can look at the ticket mentioned earlier #3226 it's a "metaticket" now, there a few cases of expressions to work on.

github-actions[bot] commented 2 weeks ago

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