75
Views
7
Comments
Solved
Max. Records in Aggregate
Question

AI mentor wants you to put max records. So the aggregate needs to use amongst others for instance companies. So to give the aggregate a max record of companies we can use an aggregate to get a count of the number of companies that the system has. However, that aggregate needs a max records which for AI mentor we need to guess so we use 9999999. Is there a better way to do this?

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

 The point of this rule is to make us think about how much records we really need.

The solution is to mark it as ,"won't fix" in AI Mentor Studio, if we really want our aggregate to fetch everything. 

Any tricks ( large hardcoded number / site property / doing an extra count aggregate upfront ) are hiding the fact that we fetch everything.  

A number of "won't fix" in AI Mentor Studio is superior to a number of obfuscated max record retrieves with these tricks.

Dorine

2025-11-25 13-20-12
Tamirys Silva Barina

Hi @Klaus Geerthsen ,

In this case, It's better leave without the max records and ignore the warning in the AI mentor than set a random number, as Outsystems will manage better the query. Max. Records missing is just a recommendation to prevent excessive data retrieval, it's not mandatory to set it.

Kind Regards,

Tami

2024-10-12 12-11-20
Kerollos Adel
Champion

Hi @Klaus Geerthsen  , 

           i think you can add some site property help you to make it dynamic somehow .

2026-01-28 16-57-48
Mihai Melencu
Champion

Hey @Klaus Geerthsen ,

The Count property of an aggregate gives you the total number of records no matter what you set for Max Records. So, a neat trick is to create an aggregate with Max Records set to 1 and use its Count value to set the Max Records for your main aggregate.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

@Mihai Melencu ,

What would be the benefit of this?  If you want it to retrieve everything, just leave MaxRecords empty.

Dorine

2026-01-28 16-57-48
Mihai Melencu
Champion

Hey Dorine, there’s no real performance benefit to this, but it’s probably the best way to handle the feedback Klaus got from AI mentor about using max records without affecting performance. 

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

 The point of this rule is to make us think about how much records we really need.

The solution is to mark it as ,"won't fix" in AI Mentor Studio, if we really want our aggregate to fetch everything. 

Any tricks ( large hardcoded number / site property / doing an extra count aggregate upfront ) are hiding the fact that we fetch everything.  

A number of "won't fix" in AI Mentor Studio is superior to a number of obfuscated max record retrieves with these tricks.

Dorine

2022-12-30 07-28-09
Navneet Garg

Agreed with @Dorine Boudry . It doesn't make any sense to hardcode or use site properties to hiding the error in AI mentor.

Getting count only for the MaxRecords is more worse then other 2 option (one extra query just to hide a error).


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.