Mac OSX 10.6.8 QGIS 1.8.0 : I've two columns in the attribute table, name, and name2 for those labels that need to be 2 lines; multiline labelling is checked. But when I use "name"||'\n'||"name2" I only get labels when there is a printable entry for both name and name2. Can you spot what I'm missing to show the 2nd line only for labels that need it?

1 Answer 1


Thats possible only with QGIS Master at the moment:

"Strecke" || '-n' || CASE WHEN length( "Kilometer" ) > 0 THEN "Kilometer" ELSE ' ' END

You don't have the CASE statements in Lisboa.

  • Am I not correct that '' above is a null string? If so, I don't see why the case statement is needed when "Kilometer" is already null.
    – johnsankey
    Apr 3, 2013 at 16:17
  • No, I used a single blank. A Null string seems to break the labelling.
    – AndreJ
    Apr 9, 2013 at 8:14

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.