I want to create an attribute-form that displays some fields in value-related dropdowns. The goal is to limit the options in the second dropdown dependent upon the selection in the first dropdown. In my case, I have the following two fields that should be related:

  1. List "Schwachstelle" with attributes ID (PK) and Name
  2. List "Schwachstelle_spez" with attributes ID (PK), Name and ID_Schwachstelle

The key-attributes between the two lists are the ID of "Schwachstelle" and ID_Schwachstelle of "Schwachstelle_spez".

The filter I wrote for the value-dependent dropdown ("Schwachstelle_spez") is the following:

"ID" = current_value( 'Schwachstelle_ID' )

However, this does still show all possible values in the "related" dropdown.

(I took https://www.youtube.com/watch?v=8shIZrwlQt4 as an example)

This is what the layer, where I specify the Dropdown-values, looks like: no image description

And this is the layer, on which the upper layer is dependent on: no image description

Attribute table of "Schwachstelle": no image description

Attribute table of "Schwachstelle_spez": no image description

If the user were to choose "Nutzungskonflikte", "Umwege" would not apperar in the following dropdown.

  • 1
    Could you show your code? – The Rabbit Oct 28 '19 at 10:12
  • 2
    This should be possible by simply defining the value-relations in the attribute-table in the layer-properties of the qfield-project. So, there's no code except for the filter-expression. – Lara Oct 28 '19 at 10:23
  • 1
    As far as I know, QGIS does not support depending lists. So I am afraid you have to write your own code. I have the same task... – The Rabbit Oct 28 '19 at 10:49
  • 1
    Your filter looks ok, how does your lookup table/value relation layer look like? – nepluisse Oct 28 '19 at 12:21
  • I uploaded some screenshots above. – Lara Nov 4 '19 at 9:23

Try ' instead of " for the current_value()-argument within your filter-criterion. This should work:

"ID" = current_value('Schwachstelle_ID')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.