QField
QField copied to clipboard
Expressions like represent_value in related layers cause freezing
Describe the issue
Using expressions like represent_value
for the layer Display property (Layer property) of child layers of Relations (Project properties) will cause soner or later QField freezing, if such an expression is used in at least two child layers.
Reproduction steps
Steps to reproduce the issue:
- Download this zip and open it with QField.
- Tipp on between the 2 surfaces A and B causing both to be selected.
- Select surface A from the list.
- Tipp on the > on top left on the green bar with the purpose to switch to surface B.
Expected behavior
Switching from one to the other feature as explained in step 4 above should be no problem.
Observed behavior
As soon you tipp on the > arrow in step 4 above QField freezes.
Screenshots and GIFs
Cause of issue
The Display (Layer Properties) expressions of the two child layers child1 and child2 cause this issue (in QField but not in QGIS):
- child1:
concat('attribute1, represent_value: ', represent_value("attribute1"))
- child2, alternative expression with same purpose:
concat('attribute1, get_feature+attribute: ', case when "attribute1" is not null then attribute(get_feature('attribute1_lov', 'key', "attribute1"), 'value') else '?' end)
Remove resp. simplify one of the expressions by removing represent_value
or get_feature
will resolve the issue.
Discussion
Based on my experiences with some larger projects I suppose, that such expressions like above and probably also aggregate
- used in other places like Field constraints - can cause QField freezing, above all at the moment of saving during editing a feature. This is worse than the explained issue here. But this happens coincidentally. In contrast I found the issue here is a simple test to discover such problems, because it's reproducible.
Desktop (please complete the following information)
- OS: Windows
- QGIS Version 3.26.0
- QFieldSync Version: not involved
Mobile (please complete the following information)
- Device: Lenovo Tab M10
- OS: Android 10
- QField version: 2.14 and QField for QGIS unstable
Additional information
- Problem started happening recently, didn't happen in an older version of QField: No (maybe not in versions prior 2.0)
- Problem can be reliably reproduced, doesn't happen randomly: Yes
- Problem happens with all files and projects, not only some files or projects: Yes