<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>I have just tried this whilst working with some Openstreetmap
data downloaded using the OSM Downloader plugin, and loaded into
QGIS (3.16.9) directly from the .osm XML file.</p>
<p>The 'osm lines' layer has a highway attribute with 16 unique
values and NULLs. Using Select by Expression with the following:<br>
</p>
<pre> "highway" NOT IN ( 'bridleway' , 'cycleway' , 'footway' )
</pre>
<p>correctly selected rows with different values to these, but not
the NULL rows. To include NULLS, try this:</p>
<pre> coalesce( "highway",'') NOT IN ( 'bridleway' , 'cycleway' , 'footway' )
</pre>
<p>Creating a virtual layer using the following SQL:</p>
<pre>SELECT * FROM "osm lines" WHERE highway NOT IN ( 'bridleway' , 'cycleway' , 'footway' )
</pre>
<p>Returned the same set of rows as the first expression, again
without the NULLs.</p>
<p>These results are what I would expect, I am not sure why yours
differ.<br>
</p>
<p>Cheers,</p>
<p>Andy<br>
</p>
<div class="moz-cite-prefix">On 07/07/2021 08:23, Andrew Hughes
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAMvYC1Xs=YaXj6Os5vfnnNAV_v60TJCQBauT-YgDnuToc6koMw@mail.gmail.com">
<div style="padding-bottom: 10px; padding-top: 5px;">
<div style="padding:12px; border:1px solid #8D3970;
background-color:#F7F9FA; color:#8D3970; font-size:14px;
line-height:22px; font-family: Calibri, Arial, Helvetica,
sans-serif;">
<strong>CAUTION:</strong> This e-mail originated outside the
University of Southampton.
</div>
</div>
<div>
<div dir="ltr">Hi All,
<div><br>
</div>
<div>I can't for the life of me figure out why I can't "Select
all features that are
<b><u>NOT</u></b> an alley, drive-through, driveway.... "</div>
<div><br>
</div>
<div>I am trying to use "Select by Expression".</div>
<div><br>
</div>
<div>The attribute I am trying to filter with is called
"tag_service" and has 77 distinct values, including NULL.</div>
<div><br>
</div>
<div><b>Q: Why does this expression select nothing?</b></div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><i>"tag_service" NOT IN ('alley', 'drive-through',
'driveway', 'laneway', 'parking_aisle', 'parking')</i></div>
</blockquote>
<div><br>
</div>
<div>Supplementary, the following does select records (but I
want the above expression to work):</div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><i>"tag_service" IS NULL or "tag_service" = "service"</i></div>
</blockquote>
<div><br>
</div>
<div>Help would be much appreciated,</div>
<div><br>
</div>
<div>Thank you</div>
<div>Andrew</div>
<div><br>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Andy Harfoot
Skype: gdi_ajph
Teams: <a class="moz-txt-link-abbreviated" href="mailto:ajph@soton.ac.uk">ajph@soton.ac.uk</a>
GeoData Institute
University of Southampton
Southampton
SO17 1BJ
<a class="moz-txt-link-abbreviated" href="http://www.geodata.soton.ac.uk">www.geodata.soton.ac.uk</a></pre>
</body>
</html>