Skip to content

current_value in attribute form relational widget filter don't work with IN operator #66313

Description

@Djedouas

What is the bug or the crash?

The feature form has two combo-boxes, each one configured with a key-value table relational widget.

The second combo-box choices should be filtered according to the first combo-box current value.

Steps to reproduce the issue

  1. Open the test project inside the GPKG
  2. Add a feature in the table my_features with the attribute form
  3. See that whatever is selected in the id_a combo-box, the id_b combo-box choices do not change

Go in the filter expression of id_b in the form parameters to switch to a workaround expression, and see that the choices in id_b combo-box do change (see context below).

Versions

Tested with QGIS LTR 3.44.11 and QGIS latest 4.0.2

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

No Duplicate of the Issue

  • I have verified that there are no existing issues raised related to my problem.

Additional context

Does not work with current_value(): always falling in the else part

if (
	current_value('id_a') in(1, 2),
	"key" in (1, 2),
	"key" in (3)
)

Works with with_variable()

with_variable('my_id_a', current_value('id_a'),
	if (
		@my_id_a in (1, 2),
		"key" in (1, 2),
		"key" in (3)
	)
)

Works with with_variable() even if the variable is not used but we use current_value()!

with_variable('my_id_a', current_value('id_a'),
	if (
		current_value('id_a') in (1, 2),
		"key" in (1, 2),
		"key" in (3)
	)
)

Works with equality test

if (
	current_value('id_a') = 1 OR current_value('id_a') = 2,
	"key" in (1, 2),
	"key" in (3)
)

Metadata

Metadata

Assignees

Labels

BugEither a bug report, or a bug fix. Let's hope for the latter!ExpressionsRelated to the QGIS expression engine or specific expression functions

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions