0

I'm setting up a QGIS maptip for a layer which comprises 6 text columns. I'm using a CASE WHEN expression in the HTML Map Tip window which is;

[% CASE WHEN "Confine" ='WNC' 
THEN 
"notesa"

ELSE "notes1"
END%]

This works and displays the attribute information correctly, but only for 2 of the 6 columns.

IS there a syntax to include notesb, notesc, notes2 etc in the statement above, or is this not possible within the maptips function in QGIS

1 Answer 1

2

You can concatenate multiple fields. Use the operator || if there is no null value, or the concat() function if there is any null.

enter image description here

3
  • Hi, thanks for your reply
    – Simon Hume
    Commented Aug 16 at 10:04
  • That works where i only need the maptip to show on 1 line. But i need the answer to space across 4 separate lines (1 for each reply from 4 separate fields in the atribute table of the layer) I've tried adding a <br> and '\n' in between the "notesa" & "notesb" fields but these don't. is there a way to do this
    – Simon Hume
    Commented Aug 16 at 10:08
  • 1
    yes, by adding a <br> between the fields :-) concat("notea", '<br>', "noteb") or "notea" || '<br>' || "noteb"
    – JGH
    Commented Aug 16 at 11:26

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.