Aggregate that counts 2 different attributes

I am using these entities in my aggregate, here I group the application name, then i count the espace.

this then gives me the total count of espace per application. 

But now what i cant to do is add the site properties.

Here I want to count the total site properties per Application, but what happens is my espace count changes and the becomes the total of all the site properties per application.
I want to have 2 different counts, (One where i see the count of total espace per application, and Two the total count of site properties per application.)
I cant seem to do this in one aggregate.

Hi Divan,

You cannot do what you pretend in a single aggregate. You should be able to do this using an advanced SQL query, but it would be complex.

The best way in order to achieve what you want is to have 2 different aggregates: one for the total count of espaces per application and one for the total count of site properties per application.


Kind regards,

Rui Barradas

Hi,

  1. Using an aggregate to fill a tablerecord, the Platform is optimizing to get only the needed columns. The executed SQL is something like "SELECT col1, col2, null, null, null, col6, from table..." This we all already knew
  2. Using an aggregate and get ONLY the count (Aggregate.List.Count), it will execute 2 queries. The first is "SELECT null, null, null, null, null, null from table..." and the second is "SELECT count(1) from table...". Yet, currently you can use "Group By" in aggregates, so you can you the Count by selecting the unique identifier from the query.

    Then you can get the count with Aggregate.List.current.count

So, if you don't have weird filters that need to be done in Advance Query, you can use this Group By to get the count, otherwise, use advance queries:

  • Example: SELECT COUNT(*) FROM {EntityName} WHERE ..... 


Cheers