Closed raherin closed 4 months ago
This weird behavior is actually caused by the project not being set up properly:
While the value relation for field type is properly set:
Code
, -> stores values [A, B, C ...]The value relation for sub-type is wrong:
Code
matches the type's selected Key.Setting the Key column to either fid or Species solves it, as there is now a 1-1 connection to the Value values.
So the question is: what should be displayed when the selected Key corresponds to multiple Values, and should we somehow warn users about it? QGIS handles it by displaying the first matching value. I believe our approach is more correct, we display a concatenated string of all corresponding values.
Note: there is a ticket for the plugin to detect such problems: https://github.com/MerginMaps/qgis-plugin/issues/317
Ping @raherin
When using a filter expression on a value relations widget, the app will add all values that meet the filter expression when only one value is selected in the drop-down menu while filling out the form. This can be reproduced in the example project support/form_setup.
To reproduce the issue:
Have a survey layer with a Value Relation widget and set a filter expression based on the value of another field:
The expected behaviour, which is reproduced in QGIS, is that when selecting a plant type in the form, you will be able to select a plant of that type in the form. In this case, 'Vegetable' was selected as the plant type and 'Carrot' as the plant species:
When filling out the form in the app, all of the species are saved to the field in the form. See video below:
https://github.com/MerginMaps/mobile/assets/26321345/1acb0518-53bc-4233-900d-e86ee86c6773