1

Some polygons in my map have a "name" (but no "capacity") and some have a "capacity" (but no "name") and some have both.

I want to label the polygons with the "name" and the "capacity". Therefore I use the following string:

"name" || '\n' || "capacity" 

But this does not work.

Can someone help me?

3

I'm so stupid... I've got an solution that works fine:

CASE WHEN "name" is NULL THEN '' ELSE "name" END || '\n' || CASE WHEN "capacity" is NULL THEN '' ELSE ("capacity" ) END

1

in this case using the 'coalesce function' coalesce( "name", ' ') ||'\n'|| coalesce( "capacity" ,' ')

Returns the first non-NULL value from the expression list. This function can take any number of arguments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.