https://issues.qgis.org/https://issues.qgis.org/favicon.ico2012-11-12T06:38:01ZQGIS Issue TrackingQGIS Application - Feature request #6676: more sophisticated treating with NULL values in label expressionshttps://issues.qgis.org/issues/6676?journal_id=370142012-11-12T06:38:01ZJürgen Fischerjef@norbit.de
<ul><li><strong>Tracker</strong> changed from <i>Bug report</i> to <i>Feature request</i></li></ul><p>Looks like a feature request. But not sure - which feature is desired: PostGIS doesn't have concat. We have, but it returns <code>NULL</code>, if any of it's argument is <code>NULL</code> - but that's what I'd expect from it.</p>
<p>Be have also coalesce - so you could do <code>name || ' - ' || coalesce(vyska,'')</code>. And we have CASE, so you could also do <code>name || CASE WHEN vyska IS NULL THEN '' ELSE ' - '||vyska END</code>.</p> QGIS Application - Feature request #6676: more sophisticated treating with NULL values in label expressionshttps://issues.qgis.org/issues/6676?journal_id=370632012-11-15T09:59:47Zkarpi lastname
<ul></ul><p>Hello,</p>
<p>Thanks for your response, it is really feature request more then bug as you explained, but I am confused in this:</p>
<p>-- "PostGIS doesn't have concat."</p>
<p>Exactly postgis doesn't, but postgresql does:</p>
<p>karpidb3=> \\df concat()<br /> List of functions<br /> Schema | Name | Result data type | Argument data types | Type <br />------------+--------+------------------+---------------------+--------<br /> pg_catalog | concat | text | VARIADIC "any" | normal<br />(1 row)</p>
<p>karpidb3=> <br />karpidb3=> SELECT version();<br /> version <br />--------------------------------------------------------------------------------------------------------------------------<br /> PostgreSQL 9.1.5 on i686-pc-linux-gnu, compiled by i686-pc-linux-gnu-gcc (Gentoo 4.5.3-r2 p1.4, pie-0.4.7) 4.5.3, 32-bit<br />(1 row)</p>
<p>-- "We have" ... "Be have also coalesce - so you could do ... coalesce(vyska,'')"</p>
<p>It is possible, I have some older version of qgis, - QGIS version 1.8.0-Lisboa - but if im trying enter concat() or coalesce(vyska,'') error "Expression is invalid" appears. The window 'More info on expression error' told:</p>
<p>Parser Error:<br />syntax error, unexpected '(', expecting $end</p>
<p>Eval Error:<br />No root node! Parsing failed?</p>
<p>-- Anyway. Your tip "name || CASE WHEN vyska IS NULL THEN '' ELSE ' - ' || vyska END" solved my difficulty and works ok, thanks. So the only feature request, which persist sounds: Clarify exactly which possibilities are allowed in label expression dialog (even for dumb user like me .) My first assumption is "I can enter here whatever sql query i want..." No, it is naturally not true. Then: "Ahh, I can enter only that formulas, that are proposed under my mouse" (but CASE is not there)</p>
<p>so thanks one more time and sory for my english.</p> QGIS Application - Feature request #6676: more sophisticated treating with NULL values in label expressionshttps://issues.qgis.org/issues/6676?journal_id=370662012-11-15T11:29:02ZJürgen Fischerjef@norbit.de
<ul><li><strong>Resolution</strong> set to <i>worksforme</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>karpi lastname wrote:</p>
<blockquote>
<p>karpidb3=> \\df concat()</p>
</blockquote>
<p>ah, right. Ok, and I see that concat() doesn't return NULL, if there is a NULL argument. Maybe we should change our function.</p>
<blockquote><blockquote>
<p>"We have" ... "Be have also coalesce - so you could do ... coalesce(vyska,'')"</p>
</blockquote></blockquote>
<blockquote>
<p>It is possible, I have some older version of qgis, - QGIS version 1.8.0-Lisboa - but if im trying enter concat() or coalesce(vyska,'') error "Expression is invalid" appears. The window 'More info on expression error' told:</p>
</blockquote>
<p>Might be only in master.</p>
<blockquote><blockquote>
<p>Anyway. Your tip "name || CASE WHEN vyska IS NULL THEN '' ELSE ' - ' || vyska END" solved my difficulty and works ok, thanks. So the only feature request, which persist sounds: Clarify exactly which possibilities are allowed in label expression dialog (even for dumb user like me .) My first assumption is "I can enter here whatever sql query i want..." No, it is naturally not true. Then: "Ahh, I can enter only that formulas, that are proposed under my mouse" (but CASE is not there)</p>
</blockquote></blockquote>
<p>Apparently the expression builder in master was improved. It has the CASE case in the help tree.</p>