Make order by with Query in AOT

 ̄綄美尐妖づ 提交于 2019-12-10 10:34:23

问题


I have made a query in AOT. My goal is to print information using Group by "CustGroup" and Order by "count(RecId)" desc of CustTable table. The group by works properly, but the order by does not. I can not understand why...

This is what my query looks like:

This is code I use:

Static void Query(Args _args)
{
   QueryRun  qr;
   CustTable myCustTable;
;
   qr = new QueryRun(queryStr(MyQuery));
while(qr.next())
{
  myCustTable = qr.get(tableNum(CustTable));
  info(strFmt("Group %1  Num %2", myCustTable.Custgroup, myCustTable.RecId));
}
}

The result is:


回答1:


AX does not sort by Count(RecId) but by the grouping.

You can solve your problem by dragging your query to a new view, then doing the sort on the count field of the view. You can also define the view without a query.



来源:https://stackoverflow.com/questions/22246734/make-order-by-with-query-in-aot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!