5

I have a layer of Land Uses that has a 3-tiered classification system (basically so that it can be broken down for different uses by other people).

I have managed to create Project Relations and use the Relation Reference widget to achieve the drop-downs in the forms -

Attribute Look-up Table: enter image description here

Project Relations: enter image description here

Relation Reference Widget: test

Attribute Pop-Up: enter image description here

(1) Is this the correct/intended methodology to achieve filtered drop-downs like this (where one attributes list of available values is dependant on a previous field)? Is just seems more logical to be using the filter in the Value Relation widget, except I can't get it to filter based on another field...!

(2) Is there a simple way in the pop-up to remove the table icon that brings up another form (assuming to add additional 'child' records to my parent feature)? As that is not what I am doing in this case, it's misleading to users to have it there.

  • @ Jamie: Did you find solution/code for this job? Can you share it here if possible? I want exactly what you mentioned, anyway, I am not a programmer. – Viet.GIS Nov 2 '15 at 14:29
  • @Viet.GIS: Not entirely - we can make the drop downs work using the relation reference widget (as described above) but it does overcomplicate the situation and make it hard to use for less experienced users in our workplace. In the comments to this query that I also posted - gis.stackexchange.com/questions/155195/… - someone has suggested a possible new expression that would work in feature forms. Fingers crossed this eventuates! – Jamie Nov 17 '15 at 22:54
4
  1. The widget types Value Relation and Relation Reference have a large overlap. Certain functionality - like (chained) filtering which you are using here - is only implemented for one of the two. So yes, this is a valid/reasonable approach.

  2. There is no simple way (yet) but it wouldn't be much effort to hide this button with an option in the widget configuration dialog. You can file a feature request, create a pull request or help improving QGIS by funding somebody to implement this feature.

  • Thanks for the feedback Matthias. Prior to getting the relations working this way, I had tried to use the 'filter expression' in the Value Relation widget with an expression similar to : "CLASS_ID" = (attribute($currentfeature, 'LU_CLASS') (I had the lookup table broken down into 3 tables... and I checked the he expression worked in the expression builder by populating a virtual field) - but it wouldn't work in the Value Relation widget...? Would you expect that it should/could? It just seemed a far more logical way to be structured given the values table isn't a true 'child' relation..? – Jamie Jul 29 '15 at 23:22

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.