I am currently using data defined properties and labeling to present pipes based on diameter. I now have a dictionary table that has id's for every combination of diameter and material and I'm using it with the value relation widget.

I must find a way to access the value represented by the key in the diameter || material field.

An ugly way that solves this would be to use:

   WHEN id_material_diam in (id1, id2) THEN result_formula_containing_diameter
   WHEN id_material_diam diameter in (id3...) THEN ...

Is there an elegant way that I can access the actual values for which the ID is the key?

I am using QGIS 2.2 Valmiera

  • Have you tried to create a new column out of the two using the field calculator? – AndreJ Mar 13 '14 at 7:21
  • Instead of diameter + material (e.g. 300 Stell) I have now an id. The value behind the id shows on account of the value relation widget. The question is how to have this in the expressions. I know how to create a new column and fill it with the actual values but that would be redundant and I want to avoid that. Thank you anyway – tudorbarascu Mar 13 '14 at 7:42
  • 2
    Have you tried to create a join to the other layer? – Matthias Kuhn Mar 13 '14 at 8:34
  • Although not what I expected, that's clearly a more elegant solution. I guess sometimes one must be told that 1 + 1 = 2 Thank you Matthias. – tudorbarascu Mar 13 '14 at 10:47
  • Unfortunately I encountered a bug: hub.qgis.org/issues/9783 as I wanted to use the values in data defined properties. – tudorbarascu Mar 14 '14 at 7:23

Matthias Kuhn has an acceptable answer although it's in the comment. Joining the dictionary table by ID and maybe hide the unneeded columns is enough.

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.