Aggregates: allow functions over calculated columns
2996
Views
7
Comments
Implemented
Aggregates & Queries
OutSystems 9
I just created an aggregate that has an "Average" of a column, but this results in a decimal, while I want a number without a fraction. But it seems I can't add a Round to a calculated column. It would be useful to be able to Round/Floor etc. the result of a calculated column.
You can create a new calculated column which rounds the value of the Average. For instance, if you create the Average of an "Age" field, and call it "AvgAge", you can use the context menu to create a new attribute and use the formula "Round(AvgAge)". Does this solve your scenario?
I'm pretty sure you can't. If I edit that new attribute's formula, the available attributes do not list columns created by Average or Count, only ones created by a Sum.
Are you sure? I may be misunderstanding your scenario, but Average and Count columns should appear in the scope (of columns created in the Group level) just like the others.
No, they are definitely not. I created a simple eSpace, that I unfortunately can't attach here, which shows this. The aggregate has a column "ValueAvg" that's the average of the Value column, and another calculated column, TwiceValue, that's simply the Value times 2. I tried to create a rounded version of the ValueAVg column, but as you can see, the expression editor only shows the attributes of the entity (TEST_DATA) and the calculated column TwiceValue, but not that of the ValueAvg column. This has likely to do with it being out of scope because of the grouping, but it is still annoying, and that's why I created this idea.


 t
Hi Kilian, thanks for the screenshot, now I understand what I was missing. Calculated attributes in gray (so, to the right) have a distinct scope from Calculated attributes in blue. In this scenario, you need to use the menu of the ValueAvg column (or other blue column) and create a new attribute from there. This new attribute should be able to use ValueAvg.
Hi Paulo,

Thanks, I didn't expect a "New Attribute" option in a menu of a column, but this indeed seems to work. Is there a way to close or remove this idea?
2016-11-21 23-23-05
Gonçalo Borrêga
Yep, closed!