Feature request #3337
Query Builder's data sampler doesn't use original dataset
|Pull Request or Patch supplied:||No||Resolution:||fixed|
|Easy fix?:||No||Copied to github as #:||13397|
Suppose you use the Query Builder to filter data on a layer. Now suppose you want to later refine the query, perhaps by adding back some data you previously filtered our.
If I click on a field on the left side and then hit Sample or All under Values, the values are only returned from the filtered dataset, not from the original dataset.
Here's where it's a problem: I have a vector layer with field rte_class with values County Roads, FC Streets, On System Highways, and Toll Roads. I previously filtered the dataset so the SQL where clause says "rte_class" = 'On System Highways'. But I wanted to go back and add another value, but I don't remember what it is. I clicked on rte_class under Fields and hit All under Values, and the only value presented is On System Highways. The only way I got the other three fields back is to clear the filter and start over.
I think that sampled data should come from the original dataset, not the filtered version of the data. I've been debating bug vs. enhancement for this, but I think it's a bug because it precludes using the Query Builder to relax a filter unless I clear the filter totally.
Only after clearing the filter was I able to produce the desired where clause: "rte_class" = 'On System Highways' OR "rte_class" = 'Toll Roads'.
#3 Updated by Leyan Ouyang about 9 years ago
- File querybuilder.diff added
I was also bitten by this bug. This is quite easy to fix if we just temporarily clear the query when getting the values to use the full dataset. There is of course a performance impact, but I think it is better than returning truncated results. Is there a more clever way to do this?
#4 Updated by Jürgen Fischer about 9 years ago
- Start date set to 2012-06-30
- Pull Request or Patch supplied set to No
- OS version deleted (
- Operating System deleted (
- Tracker changed from Bug report to Feature request
I still don't see this a bug. It's just one way it can work. If you want to add filtered out data back, you need to clear the query first (maybe copying before and pasting it back afterwards). But if you want to filter out more, it's useful that you only need to consider values that are left in the filtered dataset. I consider that a feature, that we would loose if the behaviour was changed. But there might be a checkbox that lets the user decide, which approach to use.