We have this performance issue in an AX 2012 R3 environment, where functionality that uses the "SysQueryForm" Form takes long time to build.

For example the "select" button in the Sales Invoice Posting builds a SysQueryForm with 4 datasource tables, and it takes time to build.

Looking throught the standard code, we found that the problem was in the Form SysQueryForm "queryLoad" method. There is this code:

sysQueryForm.buildAggregate(aggregate);
sysQueryForm.buildGroupBy(groupBy);
sysQueryForm.buildHaving(having);

Afther reading this blog post: http://daxfishing.blogspot.com.es/2012/04/aggregate-group-by-and-having-functions.html we found that there is new functionality in AX 2012, that enables the user to use group by and aggregate tabs in SysQueryForm.

My question is, is it neccesary for standard AX 2012 to sysQueryForm.buildAggregate(aggregate); when the Aggregate tab is not enabled?

We modified the queryload() method like this, and now our selection performance is much better:

if (AggregateTab.visible()) //Performance improvement
     sysQueryForm.buildAggregate(aggregate);
if (GroupByTab.visible())
     sysQueryForm.buildGroupBy(groupBy);
if (HavingTab.visible())
     sysQueryForm.buildHaving(having);

Any thoughts?