Why is aggregation on calculated attribute in a datagrid not supported?

3
Example is that I have a currency column without VAT, a VAT column and a calculated column showing the sum per record. I would like to see the sum of the last column. I get the errormessage that aggregation is not supported on a calculated attribute. Why is that not supported? Are there plans to support it in the future?
asked
2 answers
4

It is not supported because aggregation is done by the database for efficiency reasons and the database is not aware of calculated attributes. The solution would be to actually store and update the sum of the two other columns as a normal attribute.

answered
2

Anyway in your example you want to show the sum per record. When you think about using an calculated attribute ask yourself the following question, what happens more often? Does the value changes more often that it is shown?
- Only if your attribute changes more than it is shown in a grid you should use a calculated attribute.

I assume that in your example your sum per record doesn't change that often, so try an calculate the sum in an commit action.

(a calculated attribute can slow an retrieve action down a lot, so try to avoid them as much as possible)

answered