Aggreggate Count property with wrong value

Aggreggate Count property with wrong value

Hello all,

I'm having trouble with an aggreggate that joins multiple tables with variable search inputs.
The problem is that although the returned list seems to be accurate, the Count property of the aggreggate does not match the expected value. Most times it just returns 1 and sometimes it returns a value smaller than the actual query results.

Is anyone else experiencing this behaviour in paltform version 9 ?
João Gomes

Hi João,

Are you performing a group by in the aggregate query?

Hi Miguel,

Yes i am performing a group by.

João Gomes
The Max Records on the Aggregate shouldn't affect this count either...
I have also come across this, also having a group by. (Miguel/OutSystems: this is support case #880530)
me to, also in a group by!
I've got word from OutSystems that this issue will be solved in the upcoming platform release of 22 May.
Is this related to any specific version or is it affecting all version 9 releases?

Currently I am experiencing the same issue on Version
We've experienced it on version, and it hasn't been solved yet, so assume all versions.
I'm experiencing the bug in version
And since Kilian has an open support ticket, i don't think it has been solved yet.


The issue should affect all 9 versions as the planned release is on end of May like Killian said.

I would just like to mention that the .Count property is only to be used for pagination purposes.
On other scenarios It's most likelly that what you want is actually the .Length property (that works correcty).
Some reports of this issue were in situations where the usage not correct.

João Rosado
Just for the record, I'd like to say that we indeed encountered this issue when applying pagination to a table, and wouldn't dream of using the .Count for anything else (well, not if .Length can be used, that is) :).
"I would just like to mention that the .Count property is only to be used for pagination purposes."

I have to 100% disagree.

There are many times where .Count is the right thing to use. If you ONLY need the Count from the query, calling .Length will force it to actually retrieve all records, .Count will make it run a COUNT(*) which is far more efficient.

In fact, the only times in which .Legnth is the right choice, is when you've already (or will) pull all of the records anyways and are looping over them without restricting yourself to the portion of the record set to be displayed on screen (not using Start Index and Record Count).

Any other use of .Length is inefficient... again, the under-the-hood behavior is to actually retreive the records, push them into memory and then count the number of records.

Which is exactly why .Length is unaffected by the bug... because it isn't trying to figure out the SQL to write to convert your row selection to a COUNT(*).


I think there is a detail missing, which is that the platform runs the query one time just to get the output .Count, meaning it will run it twice - one to give the output .List and another to give output .Count

So its more efficient to always use the Length unless if the query is really only used to Count (data not iterated). So, if you don't have any limit in your .Length use it instead of running the query a second time just to get .Count

Respect ;)
Tiago -

Like I said, only time to prefer .Length is if you are going to retreive all of the records anyways.

The majority of List-style screens do NOT retrieve all of the records by default. They retreive X records, where X is the LineCount of the List on the screen. If you are iterating in Preparation or on a table refresh, you should be limiting to the records displayed on the screen most of the time.

In the applications I've worked with, preferring .Count to .Length has been a critical part of making the application perform properly... as explained to us by OutSystems during an intense, month-long performance audit.

Hello guys,

Any news about this bug?

I'm still having problems with it.

Rafael Sousa
Hi Rafael,

It should be fixed in platform server (released 22 May). So either you're not on that version, or you encounter something else.
I'm on

My problem is on the navigation of a table feeded by an aggregate with group bys.

First the count returned 1, then, after i changed the TotalRowCount from the list_counter widget to get the length instead of the count, the aggregate started to return the number of line count (from the table) plus 1 and never the right value.
Hi Rafael,

There is no platform server The latest version is, the one before that was is a Service Studio version. Can you check in Service Center wat the version of the Platform Server is?
Ah ok, the platform server is still in the

That's the problem right?

Rafael Sousa
Yes, that is the problem.

I still encounter this issue on the current version. (

Hi Christopher,

Extraordinary claims requite extraordinary proof - can you share an eSpace? :)
Hi Kilian,

Please see attached file. Kindly help me on this one. The name of the Web Form is RequestSCRAList.

Thank you.

Best regards,


Hi Christopher,

As far as I can see, everything looks good in the eSpace. What is your platform version? is the Service Studio version, but that says nothing about the platform.
Hi Kilian,

i was confused with the Service Studio and Platform versions. The platform version is still I need to discuss this one with our Administrator.

Thanks a lot Kilian.

Best regards,


Hi everyone,

I am using 9.1.501.0 and still facing problem.

Description: Aggregate returning about 100 rows but count property of aggregate is returning 0.



Hi Sahshi,

Using simple examples I was not able to reproduce the problem. Can you share your Aggregate definition or a sample OML?


Paulo Ferreira