Bug report #15930
Aggregate functions don't seem to work with virtual fields
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Virtual Fields | ||
Affected QGIS version: | 2.18.10 | Regression?: | No |
Operating System: | Windows | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 23847 |
Description
Only test with sum, count_distinct.
sum("value", "id_zone") works well with standard fields but return NULL value with virtual fields
Associated revisions
Fix aggregate expression calculation when used with virtual fields
The layer expression context (which is required for aggregate
calculation to work) was not being added to the context used
by vector layer feature iterators.
Fix #15930
History
#1 Updated by Giovanni Manghi over 7 years ago
- Easy fix? set to No
- Regression? set to No
#2 Updated by Patrice Vetsel - over 7 years ago
- Description updated (diff)
I can confirm this bug too on 2.18.7
Using this :
relation_aggregate( 'ARMOIREETLAMPES','count',"CODE")
Show right values on preview, works well with a field, but don't work with a virtual field (show NULL).
#3 Updated by Patrice Vetsel - over 7 years ago
- Affected QGIS version changed from 2.18.0 to 2.18.10
I can confirm this bug too on 2.18.10
#4 Updated by Giovanni Manghi over 7 years ago
It also still affects master.
#5 Updated by Nyall Dawson over 7 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset qgis|3f4d6de54b476176724877c5a490665fa3dcb9df.
#6 Updated by Frank Broniewski about 7 years ago
Is the fix already implemented in 2.18.14? I am having this issue too, the right values on preview and in fields, but not working with virtual fields.
#7 Updated by jd lom about 7 years ago
Frank Broniewski wrote:
Is the fix already implemented in 2.18.14? I am having this issue too, the right values on preview and in fields, but not working with virtual fields.
The fix is only implementend on master. Not sure it will be on 2.18.
#8 Updated by Frank Broniewski about 7 years ago
jd lom wrote:
Frank Broniewski wrote:
Is the fix already implemented in 2.18.14? I am having this issue too, the right values on preview and in fields, but not working with virtual fields.
The fix is only implementend on master. Not sure it will be on 2.18.
Ah, OK thanks for the info. Luckily I got around the problem by using a OGR virtual file.
#9 Updated by Dan Isaacs over 6 years ago
Nyall Dawson wrote:
Applied in changeset qgis|3f4d6de54b476176724877c5a490665fa3dcb9df.
I've just come across this problem in 2.18.18. When you say it's been implemented on the master, does this mean that, for me, the only way to get this problem fixed is to move to 3.0, or this there some patch I could apply?