Re: [Qgis-user] New Labeling: conditional labels

2012-01-06 Thread Nathan Woodrow
Love your work Martin! I'll add syntax highlighting for it tonight/tomorrow sometime. - Nathan On Sat, Jan 7, 2012 at 10:31 AM, Martin Dobias wrote: > On Fri, Jan 6, 2012 at 1:25 PM, Martin Dobias wrote: > > SQL recognizes CASE statement with following alternate syntax: > > > > 1. "if" equiva

Re: [Qgis-user] New Labeling: conditional labels

2012-01-06 Thread Martin Dobias
On Fri, Jan 6, 2012 at 1:25 PM, Martin Dobias wrote: > SQL recognizes CASE statement with following alternate syntax: > > 1. "if" equivalent: > CASE >  WHEN x > 10 THEN 'big' ELSE 'small' > END Just pushed a commit implementing that. The syntax is: CASE WHEN cond1 THEN exp1 [WHEN cond2 THEN exp2

Re: [Qgis-user] New Labeling: conditional labels

2012-01-06 Thread Mayeul Kauffmann
Martin wrote: >I would suggest to implement the CASE statement Yes that would be great!! CASE also supports another syntax which is even more flexible: CASE WHEN a=1 THEN 'one' WHEN a=2 THEN 'two' ELSE 'other' END instead of: CASE a WHEN 1 THEN 'one'

Re: [Qgis-user] New Labeling: conditional labels

2012-01-06 Thread Martin Dobias
Hi On Thu, Dec 29, 2011 at 11:33 AM, Nathan Woodrow wrote: > It would be handy to add condition statements to QgsExpression so we can > support this kind of thing, Martin would be the guy to talk to about adding > this kind of thing.  He knows the most about QgsExpression. SQL recognizes CASE st

Re: [Qgis-user] New Labeling: conditional labels

2011-12-30 Thread Andreas Neumann
Hi Giuseppe, Thanks for the further clarifications. With your additional hints I now fully understand how the substr function works and why we use *-1 here. Andreas On Thu, 29 Dec 2011 15:35:20 +0100, Giuseppe Sucameli wrote: On Thu, Dec 29, 2011 at 2:18 PM, Giuseppe Sucameli wrote: On Thu,

Re: [Qgis-user] New Labeling: conditional labels

2011-12-29 Thread Giuseppe Sucameli
On Thu, Dec 29, 2011 at 2:18 PM, Giuseppe Sucameli wrote: > On Thu, Dec 29, 2011 at 11:25 AM, Andreas Neumann wrote: >>What I do not understand is why I need the *-1 (multiplier). > > I usually use -1 in python to get the entire string ... > The function help says: > substr(string,startpos,length

Re: [Qgis-user] New Labeling: conditional labels

2011-12-29 Thread Giuseppe Sucameli
Hi Andreas, On Thu, Dec 29, 2011 at 11:25 AM, Andreas Neumann wrote: > 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). when the condition is true I need the entire string, so if id > 0 then substr(id

Re: [Qgis-user] New Labeling: conditional labels

2011-12-29 Thread Nathan Woodrow
It would be handy to add condition statements to QgsExpression so we can support this kind of thing, Martin would be the guy to talk to about adding this kind of thing. He knows the most about QgsExpression. I am also looking at adding Python support to any sections that also use QgsExpression; t

Re: [Qgis-user] New Labeling: conditional labels

2011-12-29 Thread Paolo Cavallini
Il 29/12/2011 11:25, Andreas Neumann ha scritto: > If we could combine the rule-based renderer approach with the current labeler > (with > its new query builder), it would be awesome. Agreed, I think we must use the same approach everywhere (renderer, field calculator, raster calculator, action

Re: [Qgis-user] New Labeling: conditional labels

2011-12-29 Thread Andreas Neumann
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

Re: [Qgis-user] New Labeling: conditional labels

2011-12-28 Thread Giuseppe Sucameli
Hi Andreas, On Thu, Dec 22, 2011 at 2:31 PM, Andreas Neumann 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 "

[Qgis-user] New Labeling: conditional labels

2011-12-22 Thread Andreas Neumann
Hi, Using Nathan's new query builder for labeling - how can I achieve a conditional label? 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 ">"