[QGIS-Developer] Handling NULL differs in concat vs || in expressions: let's remove ||

Matthias Kuhn matthias at opengis.ch
Tue Jan 28 04:21:44 PST 2020


On 1/27/20 8:11 AM, Richard Duivenvoorde wrote:
> On 27/01/2020 07.29, Nyall Dawson wrote:
>> On Sat, 25 Jan 2020 at 19:32, Richard Duivenvoorde <rdmailings at duif.net> wrote:
>>> Hi Devs,
>>>
>>> tldr; should the '||'-button in QGIS expressions not either behave like
>>> a real 'String concat' function,
>>> or
>>> as a logical OR
>>> or
>>> be removed?   <= my favourite
>> Massive -1. Just because something is complex, doesn't make it wrong!
> It's not complex, it is not behaving as most people think it is, or are
> familiar with AND there is not 'help' for these buttons (in contrast
> with the functions, where you could describe this behaviour).
>
> As said, it was my frustration (as in: instead of just 'using' I ended
> up trying and testing) that I "lost" labels just because whole records
> were ignorred, because certain columns had NULL values, and I ended up
> with an overly complex expression which tested IF the value was NULL.
>
> It's when I thought it was a bug that I found that other people, also
> had been there, AND found that there was another 'concat' function
> behaving a little different.
>
> In general I prefer a single intuitive working way of doing things, do I
> agree that 'intuitive' is very personal :-(
>
For what it's worth, I agree with Richard that it's often not what's 
expected. And the worst is that on first sight it looks as if it's 
working as expected.

Having the button for the unexpected more prominent than the function 
someone was looking for is not the most helpful thing.

In courses I always teach people to stay away from `||` unless they 
really know what they are doing.

I'm in favor of removal of the quick access button too.

The functionality of `||` on the other hand should be left untouched. 
(it's useful to have e.g. `prefix || filename` produce NULL if filename 
is NULL)

Matthias

> Regards,
>
> Richard Duivenvoorde
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>


More information about the QGIS-Developer mailing list