When attribute filters are included in a Query or Proximity search, we pre-populate the filters for convenience.
For string fields, we list all unique values for the field in the entire data table in a dropdown field with a typeahead function and for numeric fields we provide the MIN and MAX values in the entire data table.
This helps the user set the query parameters quickly and accurately, without the need to type a long string that exactly matches an attribute value, for example.
This convenience comes at the expense of filtering out all records that contain null values, or empty cells in your CSV.
Take these three records from a dataset:
id | parcel | zoned | valuation |
1246844C | 09C | red | 93278 |
1246845C | 09D | blue | |
1246846c | 09E | blue | 156845 |
Say you want to find all parcels where zoned = blue. You also want to perform queries that will find parcels based on valuation. When you set up the query tool you would thus enable attributes zoned and valuation as attribute filters, and then you try to perform a query.
The Query tool will populate the zoned filter with attributes red and blue; the valuation filter will populate with the min and max values 93278 and 156845.
If we run the query to return all features where zone=blue, and leave the valuation range untouched, we will only get one record as the result, despite there being two records where zoned=blue.
This is because the query filters act as an AND operator, so your query is really asking, show me ALL records where "zoned= blue" AND "valuation= any value MIN <> MAX".
As valuation has no value for the record that contains parcel 09D, it doesn't fall within the filter, so the feature cannot be returned in that query.
There's two ways to solve this kind of problem: in the attribute table, or in the query setup.
- The Data solution: add a value to all records in attribute fields that are going to be used in query filters. For example, if the value for valuation is 0, then it would be found in the above query.
- The Query Tool solution: when performing a query, click into the numeric range fields and delete the values in both min and max fields. This will allow a feature with no value to be found in the example query above.
Which solution is best? Whatever works best for you, but if you have lots of other people using this query, we'd always recommend the data solution, as that requires no additional user education.