I'm using QGIS 2.14. I have a field defined as a value relation (widget). I would like to show the value in the linked "value column" as a label in the map in stead of the value of the "key column". Is there a way to achieve this?


I found the answer myself. This should be the label-expression:

attribute(get_feature('VALUE_LAYER_NAME', 'KEY_FIELD', KEY), 'VALUE_FIELD')

VALUE_LAYER_NAME: the name of the layer having the value column (the linked layer)

KEY_FIELD: the name of the key column in the VALUE_LAYER_NAME

KEY: the name of the field in the layer you are labeling (the one with the value relation defined)

VALUE_FIELD: the name of the value column in the VALUE_LAYER_NAME

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.