Unofficial Content

The Calculation Group property is a Query object property that consists of a string that allows defining a group of attributes that are calculated together and separated from all the others attributes. It's only available for attributes with aggregation functions previously applied.
This property attempts to solve the problem of some "incorrect" Query results (these are not incorrect, but they are not the expected ones). The cause of the problem is that when the Select is calculated makes a Join between tables that are related by attributes, and this not always provides the expected results.

As an example imagine that we have Countries, Cities, and Attractions as described below:

Calculation Group definition 1

Obs:  An Attraction may not have a CityId set, and a City may not have any Attraction. However, a City always belongs to a Country and an Attraction too.

If we execute the following Query:

Calculation Group definition 2

 

It will only return the CountryNames of those Cities that have one or more attractions, countries with no attractions will not be shown. This behaviour it's caused because the relationship among Country and Attraction tables, the calculated Select makes a Join between the two tables. 

 

Calculation group property value Result
Calculation Group definition 6  Calculation Group definition 3

 

Using the Calculation Group property, we can solve this problem correctly and show all the cities no matter the attractions quantity. To do so, we only have to set on differents Calculation groups those attributes that we want to be calculated separated.

 

Calculation group property value Result
Calculation Group definition 5  Calculation Group definition 4

 

Attributes with the same calculation group will be calculated together.


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant