1

I am absolutely puzzled what went wrong here:

I am setting up a project in QGIS 3.16.11 which should be taken into field with QField 1.11 in order to collect data about the local situation concerning retail, gastronomy and so on. All of my layers and tabs are stored within the same GeoPackage.

Most of the logic is working fine, but my value relations somehow save the wrong values. I use several containers within the field forms for conditional visibility.

conditional visibility

i.e. if the user ticks one value in a field above, they get to see the corresponding group of fields. Some of these fields use value relations pointing at a table which match entries given in the field above and all desired dropdown values 1:N.

value relation widgets

relation table

The odd behaviour comes in now: When I edit data in QGIS, picking the desired value within the value relation widget in QGIS, I end up with the first corresponding value of Field2 after having saved my edits (not the one I picked).

result from qgis

When I do the same in QField, it even gets worse: It writes the Field1-value.

result from QField

Where am I mistaken. Where should I search, or how can I start debugging?

----- UPDATE-----

signedav pointed me in the right direction: In my case, I just had to change the key column from "Field01" to "Field02" because I wanted to pick one of these unique values. My mistake was to assume that "Field1" needed to be given in order to relate back to the right entry in "GESCHOSS_NUTZUNGSART". Instead, the filter expression already does this job.

I also found there is an almost identical topic in the forum: Value relation widget in QGIS

1 Answer 1

0

Field1 is used as key column. Field2 as the "descriptive" value column that is displayed in the dropdown*.

The values in Field1 act as keys and must be unique.

Otherwise you store in your field EH_HAUPTSORTIMENT always the value "1_Einzelhandel". No matter what you choose in the dropdown. And when "1_Einzelhandel" is stored it displays the first found "descriptive" value from Field2. What is "LM_Reform...".

In QField the same is done. Storing "1_Einzelhandel" in any case. In your table there apparently no widget is configured. So no "descriptive" value is displayed but the real content of the field.

* I admit that the names are confusing. As well in English. An ongoing discussion in this issue https://github.com/qgis/QGIS/issues/46363

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.