Bug report #20199

Aggregate function is not working

Added by Dan Isaacs over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Expressions
Affected QGIS version:3.3(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:wontfix
Crashes QGIS or corrupts data:No Copied to github as #:28020

Description

When using the aggregate function , the field calculator shows the correct figure, but the attribute table is empty.

Desktop.zip (12.7 KB) Dan Isaacs, 2018-10-23 06:57 PM

History

#1 Updated by Harrissou Santanna over 5 years ago

  • Status changed from Open to Feedback

More information is needed: steps followed, field type, expression used and even data to test...
Thanks

#2 Updated by Dan Isaacs over 5 years ago

Test file uploaded. I've included a reference function (using ref Functions plugin) for comparison. You should see that Test Layer 2 has a couple of aggregate functions based on Test layer 1. Both give appropriate results in the expression calculator, but the fields are empty in the attribute table.

#3 Updated by Dan Isaacs over 5 years ago

It seems possibly as though, unlike a normal expression, aggregate expressions need to be stored in exactly the same field type as the the most data dense field within the whole function. So if there's one field in the expression which is a real number at 3 decimal places, the expression field has to be a real number to 3 decimal places. That seems to now be getting it to work. It would be good if it could work just like the other expressions though.

#4 Updated by Giovanni Manghi over 5 years ago

Dan Isaacs wrote:

It seems possibly as though, unlike a normal expression, aggregate expressions need to be stored in exactly the same field type as the the most data dense field within the whole function. So if there's one field in the expression which is a real number at 3 decimal places, the expression field has to be a real number to 3 decimal places. That seems to now be getting it to work. It would be good if it could work just like the other expressions though.

Can you suggest a new subject and description? Thanks!

#5 Updated by Dan Isaacs over 5 years ago

Giovanni Manghi wrote:

Dan Isaacs wrote:

It seems possibly as though, unlike a normal expression, aggregate expressions need to be stored in exactly the same field type as the the most data dense field within the whole function. So if there's one field in the expression which is a real number at 3 decimal places, the expression field has to be a real number to 3 decimal places. That seems to now be getting it to work. It would be good if it could work just like the other expressions though.

Can you suggest a new subject and description? Thanks!

I'd probably just put it to a feature request to allow support for integer field types, but in that case it would be of such low priority as to be not worth doing right now. Perhaps just a few lines in the documentation to the effect that aggregates must be in decimal format, but I'm not sure how to request that. In any case, I think this bug can be closed as it's not failing in the manner specified.

#6 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to wontfix
  • Status changed from Feedback to Closed

I'd probably just put it to a feature request to allow support for integer field types

feel free to open that.

Also available in: Atom PDF