I need to label some polygons with 2 fields using only one label:
The first being a field in the attribute table named "Bio-Code"
the second one being optional if a cell in the field "BBT-Code"
is filled with numbers.
The first field and second field should be separated by a slash "/"
(not the slash used as operator)
I have yet not been successful at creating an appropriate expression. Could you point out where I have made mistakes?
Bio_Code
/
CASE
WHEN "BBT_CODE" IS '12500' THEN '12500'
WHEN "BBT_CODE" IS '12714' THEN '12714'
WHEN "BBT_CODE" IS '715212' THEN '715212'
WHEN "BBT_CODE" IS '715222' THEN '715222'
WHEN "BBT_CODE" IS NULL THEN 'None'
END
Single labels
instead of rule-based, you could try the following expression:if("BBT_CODE" is not NULL, "Bio_Code" || ' / ' || "BBT_CODE", "Bio_Code")
– Joseph Nov 4 '19 at 10:54