[Qgis-user] Multy field labels

Andreas Neumann a.neumann at carto.net
Fri May 15 07:29:25 PDT 2015


Hi,

You need to use COALESCE(labelfield,'alternate text')

If the label contains data, the data is used, if it contains NULL, the 
alternate text is displayed, which often is an empty string, a 
replacement text or another field.

In your case, you could use:

COALESCE("NAME_GEO" || '(' || elev || ')','elev')

In case it has a name, the name is displayed with elevation, if it is 
null, then the elevation is displayed.

This is the same syntax like SQL is using.

Hope this helps,
Andreas

On 15.05.2015 16:01, Irakli Ugulava wrote:
> For physical map need to label summits and elevation points, some of 
> them have name some no, so I need to label them from different fields.
>
> when I use expression :
>
> "NAME_GEO"   ||  "elev"
>
> It works, but summits with no names, (field "NAME_GEO" is empty), has 
> no label at all, according to ArcGis logic they should have only 
> elevation on labels.
>
> I try following expression
> CASE WHEN "name_geo" is null   THEN "NAME_GEO"   || "ELEV"  ELSE "elev"
>
> but it return no labels at all.
>
> Thanks All
>
> -- 
> Irakli Ugulava
> Senior GIS Expert, Cofounder
> GeoLand Ltd.
> 3 Telegraph Cule-de-sac
> Tbilisi 0105, Georgia,
> Tel:  +995 32 922553
> Mob +995 99 172016
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150515/c9558db8/attachment.html>


More information about the Qgis-user mailing list