QGIS icon indicating copy to clipboard operation
QGIS copied to clipboard

Default values depending on other fields are not correctly applied when field not part of form made by Drag and Drop Designer

Open mblesius opened this issue 1 year ago • 0 comments

What is the bug or the crash?

I have a vector layer with two fields: field_a and field_b and I have set up an attribute form using the Drag and Drop Designer. In my case, "field_a" is editable and has no default value. On the other hand, "field_b" is not editable, but has a default value definition in which "field_a" is used, e.g. like title("field_a").

Now, if "field_b" is not part of the attribute form set up using the drag and drop designer, it appears that the default value is not applied when adding or modifying features. In fact, the return value of "field_a" (as used in the default value expression) is always NULL. This does not happen if "field_b" is present in the form.

Steps to reproduce the issue

Download the sample_project.zip

  1. Open the sample project from the attached geopackage
  2. In the TOC select "test_layer_a" and digitize a new feature
  3. For "field_a" type in e.g. "london", hit OK
  4. Select "test_layer_b" repeat the prevvious steps

test_digit_form

Versions

QGIS version 3.36.2-Maidenhead QGIS code revision 6d250527
Qt version 5.15.13
Python version 3.12.3
GDAL/OGR version 3.8.5
PROJ version 9.4.0
EPSG Registry database version v11.004 (2024-02-24)
GEOS version 3.12.1-CAPI-1.18.1
SQLite version 3.45.1
PDAL version 2.6.3
PostgreSQL client version 16.2
SpatiaLite version 5.1.0
QWT version 6.2.0
QScintilla2 version 2.14.1
OS version Windows 11 Version 2009
       
Active Python plugins
db_manager 0.1.20
grassprovider 2.12.99
MetaSearch 0.3.6
processing 2.12.99

Supported QGIS version

  • [X] I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

mblesius avatar May 13 '24 12:05 mblesius