[Qgis-user] Conditional expressions in Field Calculator and Labels?

Andreas Neumann a.neumann at carto.net
Wed Oct 10 11:38:56 PDT 2012


Hi,

Yes - this is possible with the SQL CASE syntax - like:

CASE WHEN val < 0 THEN 'negative'
  WHEN val = 0 THEN "neutral'
  ELSE 'positive'
END

You can of course use different fields in the statement.

Hope this helps,
Andreas

Am 10.10.2012 09:06, schrieb Davide Inchingolo:
> Dear List,
> I'm new in QGis, and I like this software very much.
> Now, my question: is it possible, in Field Calculator and in Labels, to use conditional expressions in the form: IF <condition> THEN <result> ?
> I would like to use expressions in which <condition> is based on other fields in the Attribute Table, and write the <result> for the field I am calculating, or for the labels.
> I hope it is so, but, not knowing SQL well, I don't know the correct sintax, nor if it is possible...
> 
> Hoping in some gentle replies,
> Best regards
> Davide Inchingolo
> 
> 
> 
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
> 




More information about the Qgis-user mailing list