mobile icon indicating copy to clipboard operation
mobile copied to clipboard

Use of 'OR' operator breaks visibility control expression in cascading forms

Open raherin opened this issue 1 year ago • 0 comments

When using multiple group boxes to order a survey where there are visibility control expressions for nested categories, use of the OR statement in a higher-level group visibility expression will cause all of the nested groups to become visible when conditions prior to the OR statement are met but will work as expected when conditions after the OR statement are met.

A user has submitted a MWE project that is publicly available titled 'test_groupbox_expressions'. Within the example, the survey layer has a field 'test_text' which is a value map widget containing values that are referenced to control visibility of group boxes in the form. There is a container tab called 'test_text_question_group' that contains other group boxes. The container tab also has a visibility control expression left(test_text,3) in ('svp','xxx') OR test_text in ('yyy1', 'ppp1').

image

Each group box within the 'test_text_question_group' tab also has a visibility control expression, for example: test_text = 'yyy1'

image

In QGIS, the behaviour of the form is as expected. If 'svp1' is selected in the 'test_text' field, the corresponding group box will be visible on the form.

image

If 'svp2' is selected, the container tab is visible but does not have any group boxes visible.

image

If 'yyy1' is selected, the corresponding group box is visible.

image

However, in the app all of the group boxes are visible if 'svp1' or 'svp2' are selected.

Screenshot_20240306_125553 (1)

If 'yyy1' is selected only the corresponding group box appears, as expected.

Screenshot_20240306_130101

I've tested this out by changing the order of conditions in the 'test_text_question_group' to "test_text" in ('ppp1','yyy1') OR left("test_text",3) in ('svp','xxx') and the behaviour in the app is reversed so that if 'yyy1' is selected, all of the group boxes become visible and if 'svp1' is selected, only the corresponding group is visible.

Screenshot_20240306_130431

raherin avatar Mar 06 '24 13:03 raherin