Hi Giuseppe,

Thanks for your hint with the syntax - it works in my case.

I think I sort of understand the syntax - at least the > operator and the substr. What I do not understand is why I need the *-1 (multiplier).

But I think the syntax is far from being intuitive, without some help. Maybe we can come up with a simple solution in the future?

If we could combine the rule-based renderer approach with the current labeler (with its new query builder), it would be awesome.

Thanks for your help!

Andreas

On Wed, 28 Dec 2011 20:01:43 +0100, Giuseppe Sucameli wrote:
Hi Andreas,

On Thu, Dec 22, 2011 at 2:31 PM, Andreas Neumann <[email protected]> wrote:
What I want is that a label is only drawn if a column value is larger than
0. I don't want to label features with a value of zero.

Do you have any hints how the syntax works for such a case? I see ">"
operators but no "if" or "when".

there's no "if" operator, but ">" returns 1 if true and 0 if false,
e.g. (field > 5)*10 let's give you 10 or 0 as result.

The problem is that you don't want to display anything when
the field value is 0, so we can use the substr function.

Here's the solution to your problem:
substr(id, 0, (id > 0)*-1)
that means if id <= 0 then substr(id, 0, 0) else substr(id, 0, -1)

In general:
substr(output, 0, (condition)*-1)

Cheers.

If it is not possible, then I can still do it in Postgis, but it would be
nice being able to do this in QGIS.

Thanks for any hints,
Andreas

--
--
Andreas Neumann
Böschacherstrasse 10A
8624 Grüt (Gossau ZH)
Switzerland
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

--
--
Andreas Neumann
Böschacherstrasse 10A
8624 Grüt (Gossau ZH)
Switzerland
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to