3

I have concatenate the values of two field like

"BYKV_BTYP" || '/' || "FFH"

Is it possible to draw the value of the column "FFH" in italic if it is not empty and the value of "BYKV_BTYP" normal? Such as

G212-6510

3
  • 2
    There is an old/existing feature request for this but I don't think it has been implemented (certainly not in 2.6). It certainly would be nice to have. Mar 24, 2015 at 17:42
  • @MappaGnosis please post that as an answer.
    – underdark
    Mar 24, 2015 at 18:04
  • @underdark NP posted as requested Mar 25, 2015 at 7:07

2 Answers 2

3

(Comment reposted as an answer as per Underdark's request)

There is an old/existing feature request for this but I don't think it has been implemented (certainly not in 2.6). It certainly would be nice to have

1

It can be done if you "Render as HTML" the label.

So the expression would be:

[% "BYKV_BTYP" %]/<i>[% "FFH" %]</i>

enter image description here

This would also work for Bold, and other text styles.

3
  • Please note that as of QGIS 3.10 this works only if four conditions are met: (1) the text is inside a label object in layout view, not a label in the project/map view; (2) the layout is generated as an atlas; (3) all the fields belong to the coverage layer defined in the Atlas tab; (4) atlas preview is enabled. It is not possible yet to enable html rendering for labels in a map (e.g. mountains peaks). If you are looking for this kind of customisation please look at gis.stackexchange.com/questions/48389/… for some workarounds.
    – furins
    Dec 11, 2019 at 14:11
  • You are correct. I think I misunderstood what label the poster was referring to. This is for print composer labels, not map feature labels. Dec 11, 2019 at 14:57
  • I think the original question was somehow unclear. Your answer addresses the case mentioned in the feature request in QGIS issue tracker and improves at the same time @mappagnosis answer, so... thank you!
    – furins
    Dec 12, 2019 at 15:12

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.