Handling NULL values in labeling

المشرف العام

Administrator
طاقم الإدارة
In QGIS (2.10.1 on a Mac), I am trying to make some multiline labels on a map I have with a bunch of trees in them. In the attribute table I have columns with the Latin scientific name, the English name (when one exists), the year the tree was planted etc.

I am labelling the trees in my map with an expression like this:

genus_species + '\n' +case when "english_species" is not null then "english_species" + '\n'end+ to_string( "planted_year")This works well for the rows where english_species is not null, however whenever I have a row with no English name, the entire expression just seems to break and nothing is printed, not even the scientific name or the year (which always exists).

I have tried adding a

when "english_species" is null then ''But that doesn't work either. The expression just breaks for rows with no value in the field english_species.

Thank you in advance for any pointers.



أكثر...
 
أعلى