Hello,
I try to calculate an area default value when creating a new polygon.
In my QGIS project no problem but the same project in LWC it doesn’t work. There is a particular something to do to solve it ?
QGIS desktop: 3.40
QGIS server 3.44
LWC 3.9
Thanks
You can use a calculated field instead of a field with a default value.
1 Like
Yes it’s a good alternative and it works very well. Thank you very much.
But you know why the “default value” in the QGIS form however the same expression (round($area)) doesn’t work ?
Thanks again
Yes. When you create a new object in QGIS, you first draw it. This allows QGIS to analyze its geometry when the form opens.
However, in Lizmap, the form opens as soon as you add a new object, without needing to draw it beforehand.
Therefore, the default behavior cannot be applied.
If you really need to store the area, an alternative is to apply an AFTER INSERT or AFTER UPDATE trigger on the database side.
2 Likes