I'm building a rather complex entry form for a layer stored in a PostGIS database. I am following this usage scenario:

On several occasions I have dropdown fields which lets the user select a type of artefact (populated through value relation to another table in a database), followed immediately with the field letting them select a subtype (also populated through value relation to another table in a database). I would like a choice of subtypes in the dropdown to be limited by the previous selection of a type.

For example, if type "ceramics" is selected the subtype dropdown needs to be limited to only options with a key value from 1 to 10.

If type "metals" is selected the subtype dropdown needs to be limited to only options with a key value from 11 to 20.

And so on.

I feel relatively fluent in SQL and qgis expression builder, and i would guess this could be achieved trough filter expression option on value relation widget, but I wouldn't know how to invoke the values from a form which is currently being filled.

I suspect some python code is needed? - I'm not fluent in python but I guess I could adapt an example of code to my needs by renaming the fields etc.

Question is similar to Field Value Mapping QGIS but the answers there didnt point me out in directions I could apply with my current knowledge.

2 Answers 2


If you create a table which as all the values you need and add to your map. Create a relationship (Project>properties>relations). Then when building your form in the edit widget properties, select value relation Here you can filter what is displayed (ie if x then show values where filterField = y)

  • Thanks a lot for the reply. I have tested this feature in 2.10 and i have to note this solves a part of the problem: the dropdown is filtered according to the values in the filter column. But i have to note that the filter value itself (which is a category of artefact) is not recorded - it either requires me to write a database trigger to fill it in or create another dropdown to select it (and that is very awkward and redundant from a user perspective). I dont wont to sound picky but i would much prefer a solution which invokes a value entered in a separate dropdown.
    – Grgoje
    Commented Jul 11, 2015 at 21:17
  • Hmm this is kind of I what I am looking for have you found the way create such a database trigger or not? Please let me know I am kind also in a bind here. Commented Mar 23, 2017 at 7:58

Get the plugin Form Value Relation. I've created a smart form with cascading drop-down boxes with this plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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