[Qgis-developer] conditions in the field calculator

Martin Dobias wonder.sk at gmail.com
Wed Mar 16 05:46:56 EDT 2011


On Wed, Mar 16, 2011 at 10:20 AM, Borys Jurgiel <info at borysjurgiel.pl> wrote:
> Dnia środa 16 marca 2011 o 10:08:47 Martin Dobias napisał(a):
>> On Tue, Mar 15, 2011 at 12:52 PM, Borys Jurgiel <lists at borysjurgiel.pl>
> wrote:
>> > Do conditional expressions work in the Field Calculator? They're listed
>> > in the Help, but I can't make them working (as I do in Raster
>> > Calculator).
>>
>> Hi Borys
>>
>> can you give me an example of what are you trying to do?
>
> Just use the functionality listed in help - comparision operators:
>
> (field_1 > field_2) * field_3 + (field_1 <= field_2) * field_4

It seems that our grammar is slightly flawed: the comparison operators
in qgis can be used only on "top level" e.g. "field_1 > 0 or field_2 =
0". So they work if you are doing a search in the attribute table, but
they don't if you're trying to use them in an expression. I see you
have already opened a bug for that. The parser and evaluation code
definitely need some love (and unit tests!!) in order to keep up with
increasing demands from the users :-)

Martin


More information about the Qgis-developer mailing list