https://issues.qgis.org/https://issues.qgis.org/favicon.ico2013-07-27T15:09:04ZQGIS Issue TrackingQGIS Application - Bug report #8369: Null propagation of fields in expression based labellinghttps://issues.qgis.org/issues/8369?journal_id=436302013-07-27T15:09:04ZNathan Woodrow
<ul><li><strong>OS version</strong> deleted (<del><i>8</i></del>)</li><li><strong>Operating System</strong> deleted (<del><i>Windows</i></del>)</li></ul><p>String + NULL = NULL. We don't treat NULL as empty string because it's not correct to do so. NULL and empty mean two different things so are treated differently.</p>
<p>The best way to handle this is using the coalesce function</p>
<p><code>coalesce("refName",'')</code></p>
<p>If refName is null then a empty string is returned. You expression would look like this:</p>
<p><code>coalesce("refName",'') || '\<br />' || coalesce("refDetail",'') || '\<br />' || coalesce("refSource",'') || '\<br />' || coalesce("refURL",'') || '\<br />' || coalesce("refDate" ,'')</code></p>
<p>You can also use the format function in order to clean that up</p>
<p><code>format('%1\<br />%2\<br />%3\<br />%4\<br />%5',coalesce("refName",''), coalesce("refDetail",''), coalesce("refSource",''), coalesce("refURL",''), coalesce("refDate" ,''))</code></p> QGIS Application - Bug report #8369: Null propagation of fields in expression based labellinghttps://issues.qgis.org/issues/8369?journal_id=436322013-07-27T21:57:39ZJürgen Fischerjef@norbit.de
<ul><li><strong>Resolution</strong> set to <i>duplicate</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>duplicate of <a class="issue tracker-2 status-5 priority-4 priority- closed" href="https://issues.qgis.org/issues/7510" title="NULL string should be valid in label expressions (Closed)">#7510</a></p>