I run a PostgreSQL database using QGIS as a frontend. I have a table in which I store archaeological finds related to sites. The finds-table has no geometry and just stores date. To be able to query my data in different ways, I have three fields to describe the nature of these finds, which are however interdependent (material,group,type). E.g. material=Pottery, group=Vessel, type=Vipperow or material=Iron, group=Sword, type=A27. I have used the value relation widget to create cascading input forms, that should allow only object types from groups that can be e.g. iron to displayed, when I set material to iron and only types of swords, when I set group to sword.

These two relations look like that in the editor: Relationship between group and material

Relationship between material and type

This worked fine as long as I only had one relation between material and group, now I entered the second one between group and type and this appears not to work. I created relation tables for both, which both look quite alike (see below) and use the same filters. However, the material-group relation works but the group-type relation does not. It shows certain possible input option but always sets the same in any case. It is also not possible to enter certain option, which are int the tables. The table I use for the relationships are.

Table with the relationship material to group = finds_groups Relation table material to group

Table with the relationship group to type = finds_types Relation table group to type

Is it possible to run double cascading value relations in QGIS, or is there some error in my settings?


In the Value Relation widget, the Value column is for the values shwon in the list, and the Key column is for the values to be stored in the table in which the widget is applied.

You are storing finds_groups.material values in the finds.group field. That is why you cannot match finds.group values in the finds.type field filter expression widget.

You need to use group column as Key and Value columns in the finds.group field widget.
In that way, the list will show finds_groups.group values that match the filter expression (those rows for which finds_groups.material value is equal to the current finds.material value), and store the choosen group value, in the finds.group field.

Then, use type as Key and Value columns in the finds.type widget. In that way, the list will show finds_groups.type values that match the filter expression (those rows for which finds_type.group value is equal to the current finds.group value), and store the choosen type value, in the finds.type field.

| improve this answer | |
  • I don't really get why, but this works. As I understood it from this introduction (northrivergeographic.com/archives/…) it should have worked the way I did it, but apparently there is an error in my reasoning. – C.-F. Vintar Jan 15 at 16:15
  • 1
    @C.-F.Vintar, in that introduction, they was storing id of the type in the wells.type field, and then filtering tableb.fk values that match the wells.type current value in the wells.subtype widget. You was storing material values in your group field (I don't know the name of your table beacuse you clip the title in layer properties screenshot), and then trying to filter groups with that material value stored. All you need to know is that the Key column parmeter of the Value Relation widget is the value to be stored in the table. – Gabriel De Luca Jan 15 at 16:33

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.