<div dir="ltr"><p>Hi,</p><p dir="ltr">Vector Layer filtering SQL syntax is limited to the data provider. If you are using a shapefile, then the provider is GDAL and you are limited to this operands:<br></p><p dir="ltr"><br><a href="http://www.gdal.org/ogr_sql.html">http://www.gdal.org/ogr_sql.html</a><br></p><p>If you used Geopackage or Spatialite or PostGIS you would probably have more datetime specific operands that might work with your field.</p><p>Alexandre Neto</p>
<br><div class="gmail_quote"><div dir="ltr">A sex, 20/10/2017, 03:30, Patrick Dunford <<a href="mailto:blackwhitekez@gmail.com" target="_blank">blackwhitekez@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have a shapefile table with 300,000 records of polygons that I want<br>
to filter for display on the map canvas. I want to use the field called<br>
"date" which is defined as a Qdate in the fields list in the<br>
shapefile's properties.<br>
<br>
The question is how to put in the filter string in the correct syntax<br>
to give me for example all the records that are for the calendar year<br>
of 1984.<br>
<br>
For example<br>
 year("date") = 1984<br>
will not work because it doesn't accept the year function from the list<br>
of functions that are available in other expression editors which allow<br>
a function list to be used.<br>
<br>
In a previous version of this table I had it was actually quite easy<br>
because the dates were input as a string and the like operator could be<br>
used. It seems with a date that is actually defined as a date field<br>
there is no obvious or easy way to input a range of dates (how do you<br>
put in a date constant) or use a function that will extract part of a<br>
date from a date field.<br>
<br>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote></div></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Alexandre Neto</div><div>---------------------</div><div>@AlexNetoGeo</div><div><a href="http://sigsemgrilhetas.wordpress.com">http://sigsemgrilhetas.wordpress.com</a></div><a href="http://gisunchained.wordpress.com">http://gisunchained.wordpress.com</a><br></div></div>