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.
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.
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).
When I do the same in QField, it even gets worse: It writes the Field1-value.
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